Answer the question
In order to leave comments, you need to log in
How to skip a character in a regular expression?
Hello everyone, I need from:
Answer the question
In order to leave comments, you need to log in
First, cut out the excess from the line, then look for what you need:
preg_match('~\d{2}\.\d{1,2}~', preg_replace('~[^\d.]~', '', $str), $match);
As far as I know, you cannot skip a character in a group. (But I could be wrong)
I suggest applying /^\w(\d{1,})\.\w(\d{0,2})/ - https://regex101.com/r/aVoTvs/5
And then just connect the values of these groups through a dot
I see that the original expression is expressed as:
letter_B digits dot letter_C digits {hereinafter optional} letter_D digits dot letter_E digits
Questions immediately arise:
s/B(\d{1,2})\d*\.C(\d{1,2})\d*\..*/\1.\2/
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question