php - preg_match Regex Matching Full String -


i have simple regex, it's matching more want...

basically, i'm trying match operators (eg. > < != =) followed string.

regex:

/^(<=|>=|<>|!=|=|<|>)(.*)/ 

example subject:

>42 

what i'm getting:

array (size=3)   0 => string '>42' (length=3)   1 => string '>' (length=1)   2 => string '42' (length=2) 

what i'm trying get:

array (size=2)   0 => string '>' (length=1)   1 => string '42' (length=2) 

what don't understand regex works on regex101

edit: clarify, how can rid of full string match?

your answer correct.group(0) whole match.group(1) if first group , group(2) second group.


Comments

Popular posts from this blog

python - mat is not a numerical tuple : openCV error -

c# - MSAA finds controls UI Automation doesn't -

wordpress - .htaccess: RewriteRule: bad flag delimiters -