Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / November 2007

Tip: Looking for answers? Try searching our database.

RegExp to extract letter/number-combination (ANNANN)...

Thread view: 
Dag Sunde - 07 Nov 2007 00:02 GMT
Can anyone help me with a regular expression that returns
the following pattern, if found: "Alpha-num-num-Apha-num-num"

Examples:
"WEBSERVER\TV-Show\Flash Gordon\flash.gordon.2007.s01e12.avi"
"WEBSERVER\TV-Show\Flash Gordon\Flash.Gordon.S01E01.avi"
"WEBSERVER\TV-Show\Flash Gordon\Flash.Gordon.S01E02.avi"

Should return:
s01e12,
S01E01,
and S01E02 respectively...

TIA...

Signature

Dag.

Roedy Green - 07 Nov 2007 00:33 GMT
>Should return:
>s01e12,
>S01E01,
>and S01E02 respectively...

see http://mindprod.com/jgloss/regex.html

Look up the source code for how to use a Matcher.
Signature

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com

Arne Vajhøj - 07 Nov 2007 03:11 GMT
> Can anyone help me with a regular expression that returns
> the following pattern, if found: "Alpha-num-num-Apha-num-num"
[quoted text clipped - 7 lines]
> s01e12, S01E01,
> and S01E02 respectively...

Try:

Pattern p =
Pattern.compile("\\p{Alpha}\\p{Digit}\\p{Digit}\\p{Alpha}\\p{Digit}\\p{Digit}");

Arne


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.