Bug 30471 - RegExp failure with (something|$)
Summary: RegExp failure with (something|$)
Status: RESOLVED WORKSFORME
Alias: None
Product: WebKit
Classification: Unclassified
Component: JavaScriptCore (show other bugs)
Version: 528+ (Nightly build)
Hardware: PC Linux
: P2 Minor
Assignee: Nobody
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-10-16 18:33 PDT by meh.ffff
Modified: 2009-11-13 13:37 PST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description meh.ffff 2009-10-16 18:33:50 PDT
I don't know if this bug has already been opened, I searched for a while but didn't find anything related, so I'm opening it.

When a friend of mine went with Arora (not sure about the version) on my website (which uses a javascript CMS) it didn't do its job because a regex was failing.

The regex is /#([^=]+?)(&|$)/, with (spider|trace)monkey it's all right, with JavaScriptCore I had to transform it into /#(([^=&]*)&|([^=&]*)$)/.

Nothing really important, just a bit annoying. Chrome/Safari/Opera are ok with that regex, so I guess it's a problem with JavaScriptCore.

Sorry for not knowing the version of Arora/WebKit my friend was using but I can't contact him right now, but it's nothing long to check. Also sorry if it was already known or just not important.

meh.
Comment 1 Gavin Barraclough 2009-11-13 13:37:57 PST
> /#([^=]+?)(&|$)/.exec("Hello #42")
#42,42,
> /#([^=]+?)(&|$)/.exec("Hello #42&43")
#42&,42,&
> /#([^=]+?)(&|$)/.exec("Hello #42=")
null

Works as expected for me – matches #<foo><amp> or #<foo><newline>.  Does not match #<foo><equals>.

Maybe my test cases are too simple.  Can you give an example input that you expect to match this regex, but that does not for you? (or vice-versa, something that should not match but does?)

Closing works-for-me, but please do reopen this bug if you have a specific test case we can use to reproduce the problem.