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

javascript - How to synchronize the Three.js and HTML/SVG coordinate systems (especially w.r.t. the y-axis)? -

javascript - How do I find how many occurences are there of a highlighted string, and which occurence is it? -

java - Reading data from multiple zip files and combining them to one -