|
-
Jun 24th, 2005, 04:52 AM
#1
More RegEx help, (looking back?)
yesterday DeadEyes thought be about ?= that is a look ahead assertion. But is there something for looking back too? I need to find a function definition. And it always has "def" infront of it. and a ( after it. So to find a function I can do:
\b[\w\d_]*(?=\()
but I need to add to that to match it ONLY if "def" is in front of it.
I.e:
def _ma5in_(
Anyone have any ideas.
ØØ
Last edited by NoteMe; Jun 26th, 2005 at 04:24 AM.
-
Jun 24th, 2005, 06:38 AM
#2
Re: More RegEx help, (looking back?)
yes there is
(?=) lookahead
(?<=) lookbehind
these are for positive matches there are also negative ones;some good info can be found here http://www.regular-expressions.info/
-
Jun 24th, 2005, 07:05 AM
#3
Re: More RegEx help, (looking back?)
wohhooo...will test it and see if I can make it work right away.
-
Jun 24th, 2005, 07:13 AM
#4
-
Jun 24th, 2005, 09:09 AM
#5
Re: More RegEx help, (looking back?)
Well it worked in my RegEx coatch testing tool. But JS is not eating it... ...
-
Jun 25th, 2005, 10:27 AM
#6
Re: More RegEx help, (looking back?)
Hehe...I am pretty stupid though....JS doesn't support lookbehind at all.. ..thats why it isn't working...
So it is possible to use the ^ for a whole word in staed of just ONE letter? Because if I do this:
[^def] then it will just test for d or e or f. Not the word def. I have too rule out all matches that has the def word in front.
so it will trigger on this one:
if sef():
but not this one at all:
def _ma5in_():
Last edited by NoteMe; Jun 25th, 2005 at 10:31 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|