Regular Expression
Posted: 27 Jul 2018
Hello,
i try to use a simple regular Expression, to get some Text into an Array.
I have a Text-Field with the following Content:
And a the following Regular Expression:
/(target="_self">).*?(<\/a>)/g
I tested it on https://www.regexpal.com/ (see Picture). The Regular Expression works well. This code i use in Forms-Designer:
The Result:
match.length == 3 (wrong)
match[0] == target="_self">Text123</a> (correct)
match[1] == target="_self"> (wrong)
match[2] == </a> (wrong)
where am I going wrong???
Best regards
i try to use a simple regular Expression, to get some Text into an Array.
I have a Text-Field with the following Content:
Code: Select all
<a href="" target="_self">Text123</a> some other text <a href="" target="_self">Textyxz</a> and some text i dont want <a href =""> dont want to </a>
/(target="_self">).*?(<\/a>)/g
I tested it on https://www.regexpal.com/ (see Picture). The Regular Expression works well. This code i use in Forms-Designer:
Code: Select all
vartext = $(".csshtmldummy").text();
var patt = new RegExp("(target=\"_self\">).*?(<\/a>)", "g");
var match = patt.exec(vartext);
alert(match.length);
match.length == 3 (wrong)
match[0] == target="_self">Text123</a> (correct)
match[1] == target="_self"> (wrong)
match[2] == </a> (wrong)
where am I going wrong???
Best regards