I have a string like this:
Code: Select all
<input id=name>
<input id=address>
Code: Select all
<input id="name">
<input id="address">
Thanks
Moderator: General Moderators
Code: Select all
<input id=name>
<input id=address>
Code: Select all
<input id="name">
<input id="address">
Code: Select all
'/id=([^"\s>]++)/'Code: Select all
id="$1"Code: Select all
var content = "<input id=name>
<input id=address>";
var re = '(\id=[A-Za-z0-9_]*)';
var myRegex = new RegExp(re,"g");
Code: Select all
var regReplace = (\id=\"[A-Za-z0-9_]*\");
Code: Select all
<input id="name"><input id="address">You're welcome. You should have mentioned that you were using JavaScript (note that this forum is PHP+regex). JavaScripts regex engine does not support possessive quantifiers and the delimiters I wrapped around the regex are used in PHP, not JavaScript. My regex works fine otherwise:pcoder wrote:Hi,
Thanks prometheuzz for your reply. I have not used regular expression yet like this.
I used your expression. It didn't work. ...
Code: Select all
id=([^"\s>]+)