Reputation: 55
I had a paragraph:
aaa-bbb-cc/my-text">my-text sas
//domain.com/my-text'> this is my-text
I want to replace all string 'my-text' to 'my replace tex' if they are not just after character '/' like:
aaa-bbb-cc/my-text">my replace text sas
//domain.com/my-text'> this is my replace text
Thank you
Upvotes: 1
Views: 54
Reputation: 1230
(?<!\/)my-text
(?<!\/)
Negative Lookbehind
since it's javascript, which does not support negative lookbehind, you can do this way:
(?=([^\/]|^)(my-text))
group 2 is your expect.
Upvotes: 2