Re: regex question

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

 



On Monday 16 May 2005 22:53, Al wrote:
> What pattern can I use to match ONLY single occurrences of a character in a
> string.
>
> e.g., "Some text @ and some mo@@re and mor@e, etc @@@.

Use the following:

/(^@)(@{1})(^@)/

This way you'll be sure the regexp will match only single occurences ot hte 
'@' symbol.
Please take in mind that if you have this symbol in the beginning of the 
string or at the end - you have to modify this.

>
> I only want the two occurrences with a single occurrence of "@".
>
> @{1} doesn't work; there are 4 matches.
>
> Thanks....

-- 

Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)

PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436

Attachment: pgp4p6O37ydYm.pgp
Description: PGP signature


[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux