Regular Expressions

User 460351 Photo


Registered User
24 posts

I know there is no support from Coffeecup for regular expressions, but I'm wondering if any users in the community have had any luck?

I can't get any custom regular expressions to work. I want something to parse out US Currency. I have tried a half dozen or so samples and nothing seems to react properly. I used regular expressions right from RegExpLib.com that supposedly do exactly what I want.

Here's the best I found: ^\$?([0-9]{1,3},([0-9]{3},)*[0-9]{3}|[0-9]+)(\.[0-9][0-9])?$

This should match currency with/without commas or leading $.


Matches: $3,023,123.34 | 9,876,453 | 123456.78
Non-Matches: 4,33,234.34 | $1.234 | abc

Problem is that it just doesn't work for me. Anyone?

Thank you.
User 38401 Photo


Senior Advisor
10,951 posts

Not sure if these will help or if you've read them already, but here's a couple of CoffeeCup articles on the subject:

http://www.coffeecup.com/help/articles/ … xpressions
User 187934 Photo


Senior Advisor
20,271 posts
Online Now

I was able to put this one together which works here but not in the form builder.
http://regex101.com/r/xX7iZ9
Very odd. I'll dig a little deeper.
/^\$?[+-]?[0-9]{1,3}(?:[0-9]*(?:[.,][0-9]{2})?|(?:,[0-9]{3})*(?:\.[0-9]{2})?|(?:\.[0-9]{2}))$/
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 187934 Photo


Senior Advisor
20,271 posts
Online Now

This one also seems to fit but won't work in the form builder.
http://regex101.com/r/hC4jX0

/^\$?[0-9]{1,3}(?:,?[0-9]{3})*(?:\.[0-9]{2})?$/
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 460351 Photo


Registered User
24 posts

Hi Jo Ann and Eric.

I think you've discovered my point that none of these seem to work. I've tested them in several online RegExp simulators and they work fine, but not in Form Builder. In fact, I can't even get simple regular expressions to work in "Custom". I haven't tried the prepared RegExp options for lack of time.

I think it may be broken.

Thank you very much. I appreciate the help.

David
User 187934 Photo


Senior Advisor
20,271 posts
Online Now

I'll open a support topic as I made a form from scratch with the HTML Editor and the regular expression works on that form.:cool:
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 187934 Photo


Senior Advisor
20,271 posts
Online Now

I've heard from the CC guru's and there appears to be a bug. Should be fixed in the next update.:)
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com
User 38401 Photo


Senior Advisor
10,951 posts

Thanks Eric for doing all that, appreciated :)
User 460351 Photo


Registered User
24 posts

Thank you, Eric, Jo Ann, and CC.
User 187934 Photo


Senior Advisor
20,271 posts
Online Now

Your welcome.
I tried altering the offending code but it still didn't work. I may be able to get it working but I hope CC fixes this soon because I could really use it.:cool:
I can't hear what I'm looking at.
It's easy to overlook something you're not looking for.

This is a site I built for my work.(RSD)
http://esmansgreenhouse.com
This is a site I built for use in my job.(HTML Editor)
https://pestlogbook.com
This is my personal site used for testing and as an easy way to share photos.(RLM imported to RSD)
https://ericrohloff.com

Have something to add? We’d love to hear it!
You must have an account to participate. Please Sign In Here, then join the conversation.