Jordurh
Jordurh

Reputation: 1

How do I use regex extract a string but not when it contains $

I need to extract a username direct from logs using regex but not when the username ends with $, example log below:

Username: domain\username

I've been using the following regex to extract data-Username:.*?\\(.*?\s

I need regex to completely ignore the string and not extract it if it ends with $

Is this possible?

Upvotes: 0

Views: 192

Answers (1)

slartidan
slartidan

Reputation: 21576

Search for a text and any non-$-sign at the end:

Username: (.*[^\$])$

http://regexr.com/3aail

Upvotes: 1

Related Questions