Jump to content
  • Advertisement
Sign in to follow this  
BleedingBlue

Some help with Regexes?

This topic is 4346 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok the string to be parsed is similar to this: blah etc, junk "some stuff""some more stuff" more filler What I want to do is make a regex that would take that string, and extract the "some stuff""some more stuff" from it, keeping it as a whole token, (since "" is a special representation meaning a single double quote) The problem is, if I try "[^"]*" it splits my string into two parts "some stuff" and "some more stuff". Of course I knew with that regex thats what I would get. Problem is, is I can't figure out a regex to treat the "" as a special condition, basically what I want is to include the "" (or any sequence of " that is a continguous sequence with a multiple of two) inside the final token, but still parse normally if its 1 "sometext" some more stuff. In other words, how can I make "" a special condition that does not negate the ^" condition, but still gets included in the final string?

Share this post


Link to post
Share on other sites
Advertisement
I had hoped that you were having trouble implementing a regex parser... sigh... oh well.

I had to implement one for uni last year, I just had a peek at the code yesterday... I'm amazed as how well it was coded.

Anyway, cool that you got it sorted.

Share this post


Link to post
Share on other sites
I'd like to some day write a regex parser, but for now writing a scripting language seems to be enough work, I'm using TRE for the regex parser, I think it works wonderfully well.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!