well I'm actually using these regular expressions in java.
my parser has to pick out location from html text as given below
some html
location.href = "ww.saf.com"
some html
but exclude location in cases like
some html
window.open(url,"_new", "toolbar=0, location=0, directories=0, status=1, menubar=1, scrollbars=1, resizable=1, width=400, height=300, top=200, left=200");
some html
I use a regular expression pattern to find the location in any HTML string
ex :
matchExp = "m!([,])(document\.l|l)ocatio(n|n.href)\s*=!is"
This match expression results in matching location in both cases
However I want to avoid matching the location in the second case. ie: one inside the window.open..and the location in there is preceded by ", ". so if I can negate the match using this preceding string..taht'll solve my problem.
I tried the following matc expression
matchExp = "m!([,(, )])(document\.l|l)ocatio(n|n.href)\s*=!is"
where I try to negate using the (, ) pattern. However this does not treat the comma and space as a single string...rather they are treated as individual characters and hence location even in the first case gets negated as welll....
Thanks