I am trying to create a regex that allows me to find instances of a string where I have an unspaced
some text/more text
It ain't pretty, but this will do what you want:
Let's break it down a bit:
(?<!")(?:\(|\b)will match either an open bracket or a word boundary, as long as it's not preceded by a quotation mark. It does this by employing a negative lookbehind.
[^"\n]+will match one or more characters, as long as they're neither a quotation mark or a line break (
\/will match a literal slash character.
(?:\)|\b)(?!")will match either a closing bracket or a word boundary as long as it's not followed by a quotation mark. It does this by employing a negative lookahead. Note that the
(?:\)|\b)will only work 100% correctly in this order - if you reverse them, it'll drop the match on the bracket, because it encounters a word boundary before it gets to the bracket.