In php, I have to open a system file and check if after 10 of a char in the case "; " what is the content right after it.
example: TPD;62384;P;;;;N;62308;N;;C;N;N;;F;02
what would be the regex for this purpose?
In php, I have to open a system file and check if after 10 of a char in the case "; " what is the content right after it.
example: TPD;62384;P;;;;N;62308;N;;C;N;N;;F;02
what would be the regex for this purpose?
You can use this regex
(.*?;){10}(.*?);
Explanation
(.*?;)
- This sequence captures everything before the ;
character lazy . {10}
- This is a quantifier, here it expresses that the previous sequence must be captured 10 times.
(.*?);
- Then after the tenth repetition of the .*?;
sequence the second catch group is placed to give match in the content after the tenth occurrence of ;
.
Note: It is worth remembering that the content you want to capture is in the second capture group of this regex, not the first.