Basic regular expression help
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.
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).
2) You can use this site you interactively test regular expressions (albeit javascript 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!
:[a-zA-Z0-9]*:
Thanks for the tip fpsgamer!
Quote:Original post by ShakedownQuote: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.<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
Popular Topics
Advertisement