General Community > Scripting Help

how do you say NOT in regex?

(1/3) > >>

Anguz:
how can I NOT a string? in boolean I know you can do either "NOT word" or "-word" and it'll leave out results with "word"

what's the way to write this in regex?

Aquilo:
I'm wondering if it would be something like preg_match("!~stuff(.*)stuff~!i",$string,$matches)
I need to read more I don't think that's right.

Aquilo:
ok maybe this is one of my problems in php :D
how do you define string? something like this

$string = 'this is text';

what would make this not be a string? or is not a string
meaning something like matching an occurrence of ? in binary

I am finding many way to say not in regex but I don't understand
what would not be a string or [^string] regex also allows (conditions)
so may be that would be something to look at.

Anguz:

--- Quote ---how do you define string? something like this
$string = 'this is text';
--- End quote ---

yeah

so if I want to match a sentences that do not contain a certain string, how would that be done?


--- Quote ---regex also allows (conditions)
--- End quote ---

what do you mean?

Aquilo:

--- Quote ---       (?(condition)yes-pattern|no-pattern)

     If the condition is satisfied, the yes-pattern is used; otherwise
     the  no-pattern  (if  present) is used. If there are
     more than two alternatives in the subpattern, a compile-time
     error occurs.
--- End quote ---
from http://us3.php.net/manual/en/pcre.pattern.syntax.php

so maybe it something like  ~^(this is text)~i

Navigation

[0] Message Index

[#] Next page

Go to full version