I'd like, ideally, not having to resort to capturing groups but rather, assert that the string starts/ends with some sequence and directly use the value matched by the regex.
Input:
map_Ks ./CarbonFiber_T.tga
Input definition:
- start of line
- maybe some spaces
- the string
map_Ks
(this is the class field I want to assign value to) - one or more spaces
- a valid file path, anything but 0x00-0x1F, 0x7C (this is the value I want to assign to the field)
- maybe some spaces
- end of line
Attempt 1: it works but result is in a captured group
(?:^\s+map_K.\s+)([^\x00-\x1F\x7C]+)$
map_Ks ./CarbonFiber_T.tga
./CarbonFiber_T.tga
Attempt 2: it works, there are no groups but the match is the entire line (ideal usage)
(?=^\s+map_K.\s+)[^\x00-\x1F\x7C]+$
map_Ks ./CarbonFiber_T.tga
Question:
Is this possible at all or am I asking the regex engine too much and simply should use capture groups?