Re: regex question
| From: | Petar Nedyalkov | Date: | Tue, 17 May 2005 06:32:09 +0000 |
| Subject: | Re: regex question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-215368@lists.php.net to get a copy of this message | ||
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: [application/pgp-signature]
Attachment: [application/pgp-signature]