I need some help creating a regex. It seems like a simple problem, but I cannot, for the life of me, wrangle out the regex.

All the regex should do is match an 'e' that is not preceed by a '\', unless there is a space between them.

Example: In this string

\viewkind4\uc1 Suspect Document

the regex would match the e in Suspect and Document, but not \viewkind


Can anyone help me out?

The description is fairly vague; if I understand it correctly, you want to match space or a start-of-line, followed by a sequence of anything but a backslash, followed by 'e'. Which translates directly to (^| )[^\\]*e . For example,

nezachem@home> cat junk 
\aaaebb
\aaa bbbe
aaae
aaa
nezachem@home> grep -E '(^| )[^\\]*e' junk
\aaa bbbe
aaae
nezachem@home>
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.