Reputation: 11
I am trying to match on product titles up until their pack size.
Examples:
To return:
Matching on numbers using [^0-9]* does not take into account names including numerical values.
Is there a [^0-9]* AND (g|l| Pack) combo i could use?
Upvotes: 1
Views: 153
Reputation: 521249
You could use the following regex pattern:
^.*(?=\s+\d+\w*(?: \w+)?$)
This regex pattern says to match:
^.* all content from the start
(?=\s+\d+\w*(?: \w+)?$) until hitting a number with optional trailing
word characters, followed by space and optional unit,
at the end of the input
Upvotes: 1