OT: regex pattern problem

Peter Kiem zordah at zordah.net
Wed Jan 7 04:15:16 UTC 2004


> I have to find all entries in a file which match the following:
>
> (pg. 2)
> (pg. 210)
> (pg. 211)
> (pg. 309)
> (pg. 4000)

I would use:

\(pg\. [0-9]+\)

This can be explained as

\(       a ( symbol, has to be escaped as ( has meaning in regexp
pg       the letters "pg"
\.       a . symbol, has to be escpaed as . has meaning in regexp
space    a space
[0-9]+   1 or more occurences of a numerical digit
\)       a ) symbol, has to be escaped as ) has meaning in regexp

-- 
Regards,
+-----------------------------+---------------------------------+
| Peter Kiem            .^.   | E-Mail    : <zordah at zordah.net> |
| Zordah IT             /V\   | Mobile    : +61 0414 724 766    |
|   IT Consultancy &  /(   )\ | WWW       : www.zordah.net      |
|   Internet Services  ^^-^^  | ICQ       : "Zordah" 866661     |
+-----------------------------+---------------------------------+
       My current spamtrap address is est0104 at zordah.net





More information about the fedora-list mailing list