Perlinn
Perlinn

Reputation: 45

Regex expression excluding "-" tag

Hi right now my regex expression is working as intended. However i wish to specifically exclude items such as how do i update my regex such that it would exclude entries with "-\d*"/ negative quantity? ?

https://regex101.com/r/4EUzLo/1

Upvotes: 2

Views: 65

Answers (1)

Andreas DM
Andreas DM

Reputation: 11018

This should work for you:

'\d+\s*([a-zA-Z].*\w)\s+\d.*'

The '\d+ will only match the positive quantities, and with less steps.

Now, just extract the info from the capture group.

Demo

Upvotes: 1

Related Questions