Search code examples
regexlatex

Writing a regex in LaTeX


In a LaTeX report I am making I have to write a regex. There is only one in the whole report, so I don't really want to use packages and so on.

This is the regex I am talking about:

^\"((\w|\s)+)\"$

I came up with this for LaTeX:

\grave{ }\backslash\"'((\backslash w\| \backslash s)+)\backslash \"' \backslash \$

This gives me like 10 errors, and I can't really see what is wrong. Okay, it looks pretty bad but all the commands should work.

Thanks in advance,

Harm


Solution

  • Use

    \verb/^\"((\w|\s)+)\"$/