I've got a string where I need to aleays select just the second and third wodr in a string. Currently I can only select the first three words but I need to skip the first word. I currently have:
^(?:[^ ]*\ ){2}([^ ]*)
Any help wouild be aprreciated. Thanks!
CodePudding user response:
You can capture the second and the third "word" as in 1 or more non whitespace characters:
^\S (\S \S )
Or if supported with a lookbehind:
(?<=^\S )\S \S
CodePudding user response:
I think this is the regex you're looking for:
(?<=\s)([^ ]*)
Link to example: https://regex101.com/r/wSdzLe/1