Javascript Regular Expression Odd Behavior?
|
10-01-2012, 01:25 AM
Post: #2
|
|||
|
|||
I believe the problem is here:
(^|\s) Each match is created by finding the space between tags. (Since space matches [^A-Za-z0-9_]). But that consumes the space!. When it loops back around to find the next match, the next character is going to be the #, which doesn't match (^|\s). So it keeps scanning until it finds a space, which skips over the next item. I believe if you change (^|\s) to (\s)* it will work for your example. But I'm not positive it catches all scenarios, you'll need to test a bit. Ads |
|||
« Next Oldest | Next Newest »
|
Messages In This Thread |
Javascript Regular Expression Odd Behavior? - icemetalpunk - 10-01-2012, 01:17 AM
[] - Ratchetr - 10-01-2012 01:25 AM
|
User(s) browsing this thread: 1 Guest(s)