Basic regular expression help

Started by
3 comments, last by fpsgamer 15 years, 11 months ago
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.
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 &#106avascript regular expressions, it should be close enough).
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!
Hah cool. So it turns out this regular expression matches my needs:

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

Thanks for the tip fpsgamer!
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 &#106avascript regular expressions.<br><br>Sorry I haven't answered your question directly, I'm quite rusty with regular expressions :)<br><br>[edit]<br><br>@Shakedown No problem.

This topic is closed to new replies.

Advertisement