Solved

Regex Help

Posted on 2015-01-09
4
96 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
4 Comments
 
LVL 70

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

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

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

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…
International Data Corporation (IDC) prognosticates that before the current the year gets over disbursing on IT framework products to be sent in cloud environs will be $37.1B.
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…

724 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