Hello,
I need to browse a list of hyperlinks, each followed by an
author, and remove the links only for certain authors.
1. I searched the archives on Google, but didn't find how to tell the
RegExp object to be non-greedy as using the ? quantifier doesn't seem
to work.
--------- SAMPLE ----------------
var items = new Array("johndoe" ,"janedoe"
// Add parentheses to match any item in items()
var list = '('
list += items.join("|")
list += ')'
//Example: <A href="dummy.php ?page=10#934569 ">TITLE
</A>, AUTHOR, April 12, 2003<br>
pattern = '<A href=".+?#[0-9]+?">.+?</A>, '
pattern += list
pattern += ',.+?<br>'
var input = new RegExp(temp,"gi ");
var output = 'TROLL<br>'
document.body.i nnerHTML = body.replace(in put,output);
--------- SAMPLE ----------------
Does somebody know how to do this?
2. Also, I notice that when using (johndoe|janedo e) in a pattern, the
value is copied into one of the $x variables. In this particular case,
I don't need this.
Is there a way to escape parentheses to tell RegEx _not_ to put this
item into a variable? I tried "\(" and "((", to no avail.
Thank you very much for any help
JD.
I need to browse a list of hyperlinks, each followed by an
author, and remove the links only for certain authors.
1. I searched the archives on Google, but didn't find how to tell the
RegExp object to be non-greedy as using the ? quantifier doesn't seem
to work.
--------- SAMPLE ----------------
var items = new Array("johndoe" ,"janedoe"
// Add parentheses to match any item in items()
var list = '('
list += items.join("|")
list += ')'
//Example: <A href="dummy.php ?page=10#934569 ">TITLE
</A>, AUTHOR, April 12, 2003<br>
pattern = '<A href=".+?#[0-9]+?">.+?</A>, '
pattern += list
pattern += ',.+?<br>'
var input = new RegExp(temp,"gi ");
var output = 'TROLL<br>'
document.body.i nnerHTML = body.replace(in put,output);
--------- SAMPLE ----------------
Does somebody know how to do this?
2. Also, I notice that when using (johndoe|janedo e) in a pattern, the
value is copied into one of the $x variables. In this particular case,
I don't need this.
Is there a way to escape parentheses to tell RegEx _not_ to put this
item into a variable? I tried "\(" and "((", to no avail.
Thank you very much for any help
JD.
Comment