• Post Reply Bookmark Topic Watch Topic
  • New Topic

looking for a regex for recognizing JMS selector string literals  RSS feed

 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi everyone,

I'm working on a JMS implementation. JMS has the notion of "selectors" which are SQL-like conditional statements such as:


Single quotes are delimiters for string literals, like "'joe'" in the example above. Single quotes inside the literal are to be escaped with another single quote:


I just can't find a regular expression that returns 'joe''s pub' when given the above string. Any ideas? Will I have to work with reluctant quantifiers here? I tried many combinations, including
'(.|'')*?'
but it doesn't do the job.

Thank in advance for your help!
 
Alan Moore
Ranch Hand
Posts: 262
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This should do it:
 
Anonymous
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Alan, thanks a million. This is awesome!
I see there's still much to learn about regular expressions.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!