Jump to content
  • Advertisement
Sign in to follow this  
Shakedown

Basic regular expression help

This topic is 3708 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'd like to be able to search a string for anything that matches this sequence: :<any number of letters and/or numbers>: For example, String line = "LB1:LB2: blah" What would be the regular expression to match this? Thanks.

Share this post


Link to post
Share on other sites
Advertisement
1) What regular expression dialect are you using? (eg. Perl regular expressions, Java script, etc.)
2) You can use this site you interactively test regular expressions (albeit javascript regular expressions, it should be close enough).

Share this post


Link to post
Share on other sites
Quote:
Original post by fpsgamer
1) What regular expression dialect are you using? (eg. Perl regular expressions?)


Sorry, Perl regular expressions (more precisely, regular expressions in Java, which are Perl regular expressions).

Quote:
Original post by fpsgamer
2) You can use this site you interactively test your regular expressions


Awesome, that's just the tool I need to learn!

Share this post


Link to post
Share on other sites
Hah cool. So it turns out this regular expression matches my needs:

:[a-zA-Z0-9]*:

Thanks for the tip fpsgamer!

Share this post


Link to post
Share on other sites
Quote:
Original post by Shakedown
Quote:
Original post by fpsgamer
1) What regular expression dialect are you using? (eg. Perl regular expressions?)


Sorry, Perl regular expressions (more precisely, regular expressions in Java, which are Perl regular expressions).


Ah. well you may want to Google for a different site as the link I provided earlier is for javascript regular expressions.

Sorry I haven't answered your question directly, I'm quite rusty with regular expressions :)

[edit]

@Shakedown No problem.

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!