How would be the correct regex to match only the first occurence of
the pattern 3.*6.
I'm trying with 3.*6 trying to match only 34rrte56, but with my current regex is matching 4rrte567890123456789123powiluur56. And if I try with ?
doesn't print anything
Thanks for your help. I want to do it in grep because I need to extract the matched strings using grep -o.
Actually, for the first example, I want to match only things that are between 3 and 6. That would be fine, not needed to match
only the first occurrence.
But for this new string, I want to match only the pattern 347 + something + 35 + 4 characters. And
After the patterns always follow 6789. But with the regex I'm trying is not printing anything.
It is not directly possible with grep because it matches regular expressions line by line.
If you can break the line into multiple lines, say by inserting a newline after this pattern is found, then you can use grep to extract all the matches.