Jump to content
  • Advertisement
Sign in to follow this  
noatom

d language regex question

This topic is 1058 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

So, I'm going through some code, and here is the problem.

 

To match something like this:

server01->/opt/prog/log

 

this regex is used:

 

regex(r"^(?P<host>.+?)->(?P<log>(?:\/[\w\.\-]+)+)(?P<ip>)$", "i");

 

 

Basically, i need to translate that regex into a c++11 regex. However, I am a little confused about the P and V letters, and the words inside tags (host, log,ip)

 

Anyone have any idea about their role?

 

Share this post


Link to post
Share on other sites
Advertisement
Have you tried searching for "d language regex", I get some promising looking guides to the regex syntax that D uses.

For example, it says here:

(?P<name>regex): Matches named subexpression regex labeling it with name 'name'. When referring to a matched portion of text, names work like aliases in addition to direct numbers.

It looks like it is a nice way to refer to the match later, but it would appear that C++ regexes did not get this feature. Edited by rip-off

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!