Re: OT: regex pattern problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



> 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@xxxxxxxxxx> |
| 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@xxxxxxxxxx




[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux