How do use regex to find match multiple matches for one attribute? -
i have table entries have attribute names "3000." entries have 1 number each attribute, entries have multiple numbers attributes. example, 1 entry have value "abc" , "def" attribute called 3000.
i want find values associated attribute called 3000, , there 3 values ... abc, def , ghi. when pull of attribute information, can see multiple values entry called 0-001:
... ^3000:abc, ^3000:def, ^3000:ghi ... i'm using following expression, returns first entry, not rest.
(attribute_list, "\\^3000:([^\\^]*),")" mytable entry_id="0-0001" it returns value "abc," want return "abc," "def," , "ghi." need achieve this?
this attributes:
(?<=\^3000:)[^,\s]+ see demo.
output: abc, def, ghi
if want return ^3000, use regex:
\^3000:[^,\s]+ explanation
- the lookbehind
(?<=\^3000:)asserts precedes^3000: - the negated character class
[^,\s]+matches 1 or more chars neither comma nor whitespace character
see demo.
reference
Comments
Post a Comment