Aug 28, 2014, 3:31 AM
[CLOSED] Regex possibly not working?
Hi,
I am working with a C# app using MVC and Ext.Net in Razor views.
I have a text field:
When I test this regex in a javascript regex tester, it matches the type of phone numbers I want it to.
but When the project loads, the regex is not being activated correctly.
If you type numbers, then letters, the field is not validated e.g. 2342 234 2sdg 234 should fail validation
If you START with a letter e.g. "sdg2342 234 23" then it the field is highlighted and the RegexText message is displayed, otherwise it just doesn't work.
Does anyone have any idea's what I am doing wrong here?
Thank you in advance!
Cheers,
Eddie
I am working with a C# app using MVC and Ext.Net in Razor views.
I have a text field:
.Add(Html.X().TextField()
.FieldLabel("Mobile")
.Text(Model.mobilePhone)
.Width(400)
.Y(30)
.Regex(@"\+?([0-9](\s|-)*)*(ext|x)?(\s)*[0-9]+")
.RegexText("Valid Format: +1 800 5551212 ext3333")
.Name("mobilePhone")
.Listeners(lst => lst.Added.Handler = @"container.myMobilePhone = this;")
)
The user should be able to type a phone number in this field and I have provided a regex to validate the number.When I test this regex in a javascript regex tester, it matches the type of phone numbers I want it to.
but When the project loads, the regex is not being activated correctly.
If you type numbers, then letters, the field is not validated e.g. 2342 234 2sdg 234 should fail validation
If you START with a letter e.g. "sdg2342 234 23" then it the field is highlighted and the RegexText message is displayed, otherwise it just doesn't work.
Does anyone have any idea's what I am doing wrong here?
Thank you in advance!
Cheers,
Eddie
Last edited by Daniil; Sep 05, 2014 at 8:09 AM.
Reason: Please use [CODE] tags, [CLOSED]