Solved

Regex Help

Posted on 2015-01-09
4
91 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 20

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Just a quick little trick I learned recently.  Now that I'm using jQuery with abandon in my asp.net applications, I have grown tired of the following syntax:      (CODE) I suppose it just offends my sense of decency to put inline VBScript on a…
More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
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…

914 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

13 Experts available now in Live!

Get 1:1 Help Now