Hi there,
In my repository i have a lot of entries with phone field (99) 9999-9999 and now i need to change regular expression to accept the format (99) 99999-9999 and (99) 9999-9999. In Brazil some states use different formats phones.
Any help ?
Hi there,
In my repository i have a lot of entries with phone field (99) 9999-9999 and now i need to change regular expression to accept the format (99) 99999-9999 and (99) 9999-9999. In Brazil some states use different formats phones.
Any help ?
You may also try the following. Also not tested.
\(\d\d\)\s\d\d\d\d\d?-\d\d\d\d
You want this for a field in your metadata? Or for pattern matching in Quick Fields?
Something like this might work, but not tested:
\(\d\d\) \d\d\d\d\d\-\d\d\d\d|\(\d\d\) \d\d\d\d\-\d\d\d\d
If in Quick Fields, something more like this:
(\(\d\d\) \d\d\d\d\d\-\d\d\d\d)|(\(\d\d\) \d\d\d\d\-\d\d\d\d)
or maybe it's something like this,
(\(\d\d\) )(\d\d\d\d\d\-\d\d\d\d|\d\d\d\d\-\d\d\d\d)
I think one of those should work for you
To my metadata
Then Ramsey's pattern below is the simplest one for field constraints.
But accepting letters ! Only number is allowed.
This should work then:
\(\d\d\) \d\d\d\d\d?-\d\d\d\d
Kenneth,
Thanks for the help, but still accepting letters...
I found this reference http://www.laserfiche.com/support/webhelp/Laserfiche/8.3/en-US/AdminGuide/Content/regularexpressionreference.htm. I'm studying but any other sugestion please be my guest to post!
try this:
\(\d\d\) \d\d\d\d\d?\-\d\d\d\d
Kenneth,
Still accepting letters, i believe that is a bug !
My version is 9.1
I havent tested, but it may in fact be a bug. The '\d' indicates to only accept digits. If you made it '\D' then it would accept anything but digits in that character location. If it's accepting characters, then something may be wrong.
Hi again....
I put this constraint \(\d\d\) (\d\d\d\d-\d\d\d\d|\d\d\d\d\d-\d\d\d\d) but is not working in the way I want! It just validade when the user saves the form, what I need is to validate the field at the time of filling.
Because your constraint (and field value) is of variable length, it can't enforce characters as the user types.
There are 2 parts to a constraint. Enforcing it when the user tries to save and setting a mask when the user tries to type. The constraint is always enforced when the value is saved. The mask is only generated for fixed lengths.
The field does not allow letters. When you try to save, you get the error about the constraint. However, because the length is variable, the Client does not set the mask, which is why you can type letters.
I want to validate the field in the time that is being filled not allowing letters in the field.
You could just use (\(\d{2}\)\s*\d{4,5}\d{4}) in both Quick Fields or Workflow.