I would like to match all chars except those specific one at the end of a word if it exists or not, for instance:
- fooBarsBar
- fooBars
I would like it match for both example "fooBars" and "fooBars" without "Bar" at then end even if it does not exist
I tried:
(.*)(?=Bar)|(.*)
And also this:
[^Bar]*
For the first regex it captures all by group and the second one it captures all chars except "Bar" but not the one at the end...
Could you please help me, thanks