Article View: news.software.readers
Article #152155Re: [OT] Help with regex please
From: Neil Woods
Date: Tue, 20 Jul 2004 20:08
Date: Tue, 20 Jul 2004 20:08
35 lines
1840 bytes
1840 bytes
Mozzy <dem_d@mail.com> writes:
> I am trying to match a string like these file names:
>
> 109006310240F90AFE3D10Fjpg
> 109022208940FB7809F1BBBjpg
>
> where there are any 23 characters followed by "jpg". Strangely
> enough there is no dot before the "jpg" at the end of the file
> name.
>
> I have used this regex test page but I can't seem to get any regex
> to work! http://www.fileformat.info/tool/regex.htm
>
> Among others I have tried these
>
> jpg = jpg anywhere
> jpg$ = jpg at end of string
> \$jpg = jpg at end of string
> \Zjpg = jpg at end of name
>
> Why don't these work?
Because they're wrong ;)
>
> What regex should I use to match those file names?
Assuming the test string (the bit before the final jpg) consists of
hexadecimal characters, then
^[0-9A-F]{23}jpg$
would match.
Neil.
Technical Details
Message-ID:
<slrncfquuf.b2l.neil@news.ops.mine.nu>Path:
mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.sjc.giganews.com!number1.nntp.dca.giganews.com!internal1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.stueberl.de!fu-berlin.de!uni-berlin.de!not-for-mailReferences:
<952C722D5471651A7E@130.133.1.4>Show Full Headers
Complete Article Headers
Message-ID: <slrncfquuf.b2l.neil@news.ops.mine.nu> Subject: Re: [OT] Help with regex please Date: Tue, 20 Jul 2004 20:08:47 -0000 From: Neil Woods <neil@suespammers.org> References: <952C722D5471651A7E@130.133.1.4> Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!illumos!news.pugleaf.net!.TX!archive.pugleaf.net!archive.newsdeef.eu!mbox2nntp-news.software.readers.20140922.mbox.gz!number1.nntp.sjc.giganews.com!number1.nntp.dca.giganews.com!internal1.nntp.dca.giganews.com!border2.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed.stueberl.de!fu-berlin.de!uni-berlin.de!not-for-mail Newsgroups: news.software.readers Organization: Huh? Lines: 35 X-Trace: news.uni-berlin.de wPu/hxni5nl1lyoaYkWX4wF7KmqAGjq9ftImS6nNs8bRU696/r X-Orig-Path: news.ops.mine.nu Mail-Copies-To: nobody X-Reg-Linux-User: #5664 User-Agent: slrn/0.9.8.0 (Linux)