Hi, i’d to update some conditions in my regex pattern.
Pattern: “(?<=(Total Amount|\bTotal\b|Total Due|Total Amount Due)\s+)(ZAR|R|)[\s-$\d,.]+”
This pattern covers: Total Amount,Total, Total Due, Total Amount Due
What I don’t Want: SubTotal - that is working fine
Problem I’m facing is: if the text is Sub Total, the pattern takes the Sub Total as Total as there is a space between the Sub and Total
I’d like to update the pattern, how can I do this
ppr
(Peter Preuss)
2
one option could be to filter out Sub Total Match aftwerwards (when not used within isMatch)
Is there a way to incorporate that into the pattern as I only get number values as output
@Mpumi_Setshedi - This is the reference to the solution provided previously, as I remember…
I have added the space between Sub Total and pattern did not pick it…I see it’s working as expected from the sample you previously shared here
Hi @prasath17
I need the pattern to not pick up SubTotal or Sub Total
I think i spoke too soon…Yes previous shared pattern is not working when there is a spaces…I will take a look, please try the method suggested by @ppr
Okay, im not sure how to approach the given method yet
You can use the Negative Lookbehind (?<!Sub +) to skip matching "Sub " in front of “Total”.
(?<=(?<!Sub +)(Total Amount|\bTotal\b|Total Due|Total Amount Due)\s+)(ZAR|R|)[\s-$\d,.]+
1 Like
system
(system)
Closed
11
This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.