News:

HOT TIP! Exploring the commands packaged in VC's standard configurations is a great way to learn how to build your own. You can also clone a command as a starting point: just right-click and select "Clone" (or type Alt-C).

Main Menu

Regex -- using curly brackets

Started by nime5ter, February 21, 2014, 06:14:05 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

nime5ter

The regex cheatsheet that is mentioned in the wiki and in the regex action descriptions (http://www.mikesdotnetting.com/Article/46/CSharp-Regular-Expressions-Cheat-Sheet) includes a couple of regular expression operators that use curly brackets:

Quote{n}   n is a non-negative integer. Matches exactly n times. For example, "o{2}" does not match the "o" in "Bob," but matches the first two o's in "foooood".
{n,}   n is a non-negative integer. Matches at least n times. For example, "o{2,}" does not match the "o" in "Bob" and matches all the o's in "foooood." "o{1,}" is equivalent to "o+". "o{0,}" is equivalent to "o*".
{n,m}   m and n are non-negative integers. Matches at least n and at most m times. For example, "o{1,3}" matches the first three o's in "fooooood." "o{0,1}" is equivalent to "o?".

Is it possible to use those in Vox, given that VC uses curly brackets for its variables?
TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)

jitterjames

You have to be careful.  If you try to use {2} in an expression, VC will try to replace it with payload 2.  If there is no payload 2 then it will leave it as is, so if you know your command is being executed without any payloads then you are free to use {2} in your expression.

If you know your command has a payload 2 attached to it, then you will need to avoid using the regex expression {2}.  This is relatively easy to do.

For example if you want to match exactly two digits using regex you can use any of the following patterns

\d\d

\d{2}

\d{2,2}


So you can use the first or the last option and just not use the middle one.

nime5ter

TIPS: POST VC VERSION #. Explain what you want VC to do. Say what you've tried & what happened, or post a video demo. Attach VC log. Link to instructions followed.  Post your command (xml)