Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #18484
| Path | csiph.com!eternal-september.org!reader02.eternal-september.org!.POSTED!not-for-mail |
|---|---|
| From | Ben Bacarisse <ben.usenet@bsb.me.uk> |
| Newsgroups | comp.lang.php |
| Subject | Re: preg_match() return false |
| Date | Mon, 28 Dec 2020 02:02:07 +0000 |
| Organization | A noiseless patient Spider |
| Lines | 41 |
| Message-ID | <877dp2adsw.fsf@bsb.me.uk> (permalink) |
| References | <rs9s7j$1vsr$1@gioia.aioe.org> <87im8n9scy.fsf@bsb.me.uk> <rsaag6$flf$1@gioia.aioe.org> <rsabtr$16ks$1@gioia.aioe.org> |
| Mime-Version | 1.0 |
| Content-Type | text/plain; charset=iso-8859-1 |
| Content-Transfer-Encoding | 8bit |
| Injection-Info | reader02.eternal-september.org; posting-host="aed18b5ebd9eff12874cf77a9da74041"; logging-data="3633"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX19gYGgeOjKLwKnH7LoTjck5DSVOyUGN/eU=" |
| Cancel-Lock | sha1:4tKlN6Kcwobm6VNavMGVRvI5+Gc= sha1:/cOfpgYXKFCF9aAJ3rVyHuI4kTE= |
| X-BSB-Auth | 1.4e2ead97102fdd020b0b.20201228020207GMT.877dp2adsw.fsf@bsb.me.uk |
| Xref | csiph.com comp.lang.php:18484 |
Show key headers only | View raw
alex <1j9448a02@lnx159sneakemail.com.invalid> writes:
> Il 27/12/20 16:50, alex ha scritto:
>> Il 27/12/20 16:33, Ben Bacarisse ha scritto:
>>> I don't know, but your regexp is odd. If you delete the second line it
>>> matches.
>> > You don't need to .+¶ after matching .+¶ because the s
>> > modifier means the first will match to the same place the second
>> > would.
>>
>> However, I need this to make sure that there are at least two lines
>> between 'Mock message' and '-----'
I would ask for that explicitly, rather than relying on the
backtracking:
(:?[^\n]*\n){2,}-----
>>> Also, you don't need \ before - or :.
>>
>> echo preg_quote('-') . PHP_EOL;
>> echo preg_quote(':') . PHP_EOL;
>>
>> Output:
>>
>> \-
>> \:
Should I have been more precise? You don't need \ before - or : in the
pattern you wrote.
<cut>
> PS
>
> Of course, "\n" means the carriage return (PHP_EOL).
"\n" means linefeed (sometimes called newline). PHP_EOL is often "\n"
but not always.
--
Ben.
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
preg_match() return false alex <1j9448a02@lnx159sneakemail.com.invalid> - 2020-12-27 12:47 +0100
Re: preg_match() return false tony@mountifield.org (Tony Mountifield) - 2020-12-27 12:50 +0000
Re: preg_match() return false alex <1j9448a02@lnx159sneakemail.com.invalid> - 2020-12-27 14:21 +0100
Re: preg_match() return false Arno Welzel <usenet@arnowelzel.de> - 2020-12-27 14:43 +0100
Re: preg_match() return false alex <1j9448a02@lnx159sneakemail.com.invalid> - 2020-12-27 14:59 +0100
Re: preg_match() return false Arno Welzel <usenet@arnowelzel.de> - 2020-12-28 15:16 +0100
Re: preg_match() return false alex <1j9448a02@lnx159sneakemail.com.invalid> - 2020-12-27 15:11 +0100
Re: preg_match() return false Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-27 15:33 +0000
Re: preg_match() return false alex <1j9448a02@lnx159sneakemail.com.invalid> - 2020-12-27 16:50 +0100
Re: preg_match() return false alex <1j9448a02@lnx159sneakemail.com.invalid> - 2020-12-27 17:14 +0100
Re: preg_match() return false Ben Bacarisse <ben.usenet@bsb.me.uk> - 2020-12-28 02:02 +0000
Re: preg_match() return false alex <1j9448a02@lnx159sneakemail.com.invalid> - 2020-12-28 10:38 +0100
Re: PHP_EOL (was: preg_match() return false) "J.O. Aho" <user@example.net> - 2020-12-28 15:43 +0100
Re: PHP_EOL alex <1j9448a02@lnx159sneakemail.com.invalid> - 2020-12-29 15:55 +0100
csiph-web