[Interest] QRegExp help: boundaries

Bo Thorsen bthorsen at ics.com
Wed Mar 27 11:31:26 CET 2013


Den 27-03-2013 11:28, Sensei skrev:
> Dear all,
>
> I am trying to use QRegExp to find if a string contains a latex command,
> but I'm puzzled on how to do that.
>
> In particular, for those who don't know latex, commands are (simplifying
> a lot) words starting with a backslash \ and using curly parentheses {}
> (and brackets []). For example
>
>       \documentclass[11pt]{article}
>
> Now, I'd like to find that command. I wanted to use a QRegExp, in
> particular this code:
>
>       if (s.indexOf(QRegExp("\b\\\\documentclass\b")) > -1)

You need to esc the \b. Write \\b instead.

Bo.

-- 
Bo Thorsen, European Qt Manager, Integrated Computer Solutions
ICS - Delivering World-Class Applications for Embedded & Mobile Devices
http://ics.com/services



More information about the Interest mailing list