Sign in to follow this  

Basic regular expression help

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

This topic is 3494 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this