You are viewing limited content. For full access, please sign in.

Question

Question

Expression regular

asked on October 10, 2014 Show version history

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 ?


 

 

 

0 0

Replies

replied on October 10, 2014

You may also try the following. Also not tested. 

 

\(\d\d\)\s\d\d\d\d\d?-\d\d\d\d

2 0
replied on October 10, 2014 Show version history

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

1 0
replied on October 10, 2014

To my metadata

0 0
replied on October 10, 2014

Then Ramsey's pattern below is the simplest one for field constraints.

0 0
replied on October 10, 2014

But accepting letters ! Only number is allowed.

0 0
replied on October 10, 2014

This should work then:

\(\d\d\) \d\d\d\d\d?-\d\d\d\d

 

0 0
replied on October 10, 2014

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!

0 0
replied on October 10, 2014

try this:

\(\d\d\) \d\d\d\d\d?\-\d\d\d\d

 

0 0
replied on October 10, 2014 Show version history

Kenneth, 

Still accepting letters, i believe that is a bug !

 

My version is 9.1

0 0
replied on October 10, 2014

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.

0 0
replied on October 13, 2014

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. 

constraint.png
constraint.png (84.3 KB)
0 0
replied on October 13, 2014

Because your constraint (and field value) is of variable length, it can't enforce characters as the user types.

1 0
replied on October 13, 2014
The field should not allow letter, but with the constraint is allowing letters. 
0 0
replied on October 13, 2014

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.

1 0
replied on October 14, 2014 Show version history

I want to validate the field in the time that is being filled not allowing letters in the field.

0 0
replied on October 14, 2014

Because your constraint (and field value) is of variable length, it can't enforce characters as the user types.

replied on October 10, 2014

You could just use  (\(\d{2}\)\s*\d{4,5}\d{4}) in both Quick Fields or Workflow.

0 0
You are not allowed to follow up in this post.

Sign in to reply to this post.