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

D

Dag Sunde

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...
 
?

=?ISO-8859-1?Q?Arne_Vajh=F8j?=

Dag said:
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...

Try:

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

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,596
Members
45,135
Latest member
VeronaShap
Top