Jared White
posted this on September 29, 2011, 17:56
My question actually revolves around trying to remove leading zeros in formatted data (like 9.2.11 instead of 09.02.11) -- but the broader question is, does Webvanta script allow for any kind of text processing using regular expression? That'd be a great feature if not.
Thanks,
Jared
Comments
Jared,
There is a very simple regex format option available for most data access tags (those that return a value). User format="gsub('regex','substitution')" as the attribute.
The 'regex' part supports most standard PCRE - Perl Compatible Regular Expressions. The formatter was meant for fairly simple expressions, and currently has some shortcomings (e.g. dealing with quotation marks--the quotes are optional around the expression and substitution, but are required if you need to include a comma, for instance).
I haven't tested this, but try:
Hi Chris,
Sorry I didn't respond to your helpful comment. This is good to know! The one problem though is I'm accessing the date field like so:
< w:get name="start_date" format="%m.%d.%y" / >
So I'm not sure how to format the format...I tried putting this in a variable with w:var ... and then putting format on that, but that didn't work. Thanks in advance if you have any tips about that.
No worries, from WebvantaScript, you can get that immediately:
< w:get name="start_date" format="%-m.%-d.%y" / >
Note the minus symbols.
Awesome. That totally works!