php preg_match_all - exclude some matches
| From: | gordonisnz at gmail dot com | Date: | Sun, 14 Nov 2021 01:17:13 +0000 |
| Subject: | php preg_match_all - exclude some matches | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-327825@lists.php.net to get a copy of this message | ||
Hello. Is this php group JUST for development progress for PHP ? or
can we ask questions here ? it's the only PHP forum I'm on.
I've used preg_match quite a bit, but am unfamiliar with preg_match_all.
Ive not started yet, but I'm going to design a script with a 500Kb
input text-file, which i want to use preg_match_all on.
Q. i guess 500Kb in a HTML form in $_POST format isn't too much ? Is it Ok ?
In development, I'm going to scan through the data/array & see the
lines Ive captured for possible exclude text, but even looking at the
raw data, I see lines I want to EXCLUDE from the results.
In the live version, I'll use it but have some excluded patterns.
I have these example lines I want to exclude. (inner patterns).
"type":"WORD1"
"type":"WORD2"
"type":"WORD3"
Q. Is there a way to use preg_match_all to extract text by an outer
preg criteria, but if the extracted text also matches one of the
chosen inner-patterns, it is NOT included in the results.
Can I do this in one go ? Or will I need to do a foreach loop in the
results to exclude / remove any unwanted sub-patterns after.
I'm not sure yet, but I expect the "wanted" text to be 10-20% of the
original text.
--
Gordon.