Solved

Regex Help

Posted on 2015-01-09
4
87 Views
Last Modified: 2015-02-11
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!
0
Comment
Question by:PhilippeRenaud
4 Comments
 
LVL 68

Expert Comment

by:Qlemo
ID: 40540640
I'll assume the characters following the colon are arbitrary, then this regex should work:  '[a-zA-Z]+:.*[a-zA-Z0-9]+'
0
 
LVL 19

Assisted Solution

by:n2fc
n2fc earned 250 total points
ID: 40540645
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
 
LVL 84

Accepted Solution

by:
ozo earned 250 total points
ID: 40541724
^[a-zA-Z]+:\s*[a-zA-Z0-9]+
0
 
LVL 1

Author Closing Comment

by:PhilippeRenaud
ID: 40604114
sorry for delay guys..thanks
0

Featured Post

Enabling OSINT in Activity Based Intelligence

Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

Join & Write a Comment

User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now