tags:

views:

104

answers:

2

Hello everyone. 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

+2  A: 

Perhaps the problem is that some of those commands (\backslash, \grave) want to be in math mode, but \" doesn't. Have you tried using \verb to include the regexp verbatim? I'm not sure if it'll look like you want (it'll be typeset in a tt font), but you could do this with something like:

...

In my project I'm using a regexp \verb@^\"((\w|\s)+)\"@ to do a thing.

...

Mike Dinsdale
+8  A: 

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

Rob Hyndman
Zero errors, why thank you :)
Harm De Weirdt