Regex Help

Hello EE,

I have a huge text file and I need get only the strings where :

Always some letters at the beginning (but never numbers), then always  the character   :   then always some letters and/or numbers

so something like this would work:

abcd: test1234

that wouldnt work :
April 24, 1946: abcd1

that wouldnt work:
abcd:

can you help? thanks!
LVL 1
PhilippeRenaudAsked:
Who is Participating?
 
ozoConnect With a Mentor Commented:
^[a-zA-Z]+:\s*[a-zA-Z0-9]+
0
 
QlemoBatchelor, Developer and EE Topic AdvisorCommented:
I'll assume the characters following the colon are arbitrary, then this regex should work:  '[a-zA-Z]+:.*[a-zA-Z0-9]+'
0
 
n2fcConnect With a Mentor Commented:
Might not be the best...
But this works:

[A-Za-z]+\:[A-Za-z0-9]+

You can try it out here:
http://regexpal.com/

or here:
http://www.regexr.com/
0
 
PhilippeRenaudAuthor Commented:
sorry for delay guys..thanks
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.