Just curious to know, I am using TextMode="Email" in asp net web form which works as expected however when we provide "info" as a part of first word(Before #) like "info#xyz.com" or "jyo.info#xyz.com" or "jyoinfo#xyz.com" then It says invalid email. I believe it is because the first word(Before #) contains "info"(all small) but making any single or all character of "info" in capital letter work fine. Anyone please explain the reason for this behavior and if i am somewhere wrong then please guide me in right direction.
You can specify your own regular expression to make the email test non-case sensitive. Below is a pretty decent regex for email testing (not too aggressive).
^[a-zA-Z0-9_.+-]+#[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$
Related
I am having the following issue while testing the dialogues of my Watson Assistant skill in Botium Box: it looks like some test cases pass with success even though there is not an exact match between the expected response and the actual response of the bot. It seems that a test case passes successfully if the expected text is a substring in the actual answer from the bot.
Is there a way to specify that I want a exact match?
Example:
If the expected response is: "Hello my name is John, how can help you?" but the actual response is: "Hello my name is John, how can help you today?"
botium box will mark this test cased as passed.
Is there a way to specify that I want an exact match between the two strings?
The default matching mode in Botium is wildcardIgnoreCase, which is a kind of simple regular expression mode (* matches everything) - more in the Botium Wiki. This mode does substring matching as well, but you can change it in the Advanced Scripting Settings of Botium Box.
Instead of configuring the matching mode globally, you can also decide to use on of the text asserters, so the test case would look like this:
asserter
#me
hello
#bot
TEXT_CONTAINS_ALL_IC hello|my name is john
I prepared a repl.it as demo.
I am new to Regex, I have a Regex expression in an asp.net ExpressionValidator with this expression in it to validate an email address.
The problem is it won't validate the email when the us.af.mil is in capital letters. The error I get is:
unexpected qualifier
All the other times all it recognizes is the lower case part of the email. I have tried several other variations on the code and nothing works. I am sure I am leaving something out but not sure what. Listed below are some of the variations. Hope someone can tell me what I am leaving out.
\w+([-+.']\w+)*#(?i:(us.af.mil))
\w+([-+.']\w+)*#(us.af.mil)|(US.AF.MIL)
\w+([-+.']\w+)*#uUsS.aAfF.mMiIlL
\w+([-+.']\w+)*#(?i)(us.af.mil)
I have the following Regex code that works fine on regex verification code but not on my website (built with ASP.NET MVC). It validates the length and numeric but not the absence of special characters.
My regex: /^(?=.*[!###$&](?=.*[A-Z]))(?=.*[0-9])(?=.*[a-z]).{8,}$/
On my website Toto1234 is considered fine but that does not be the case since it does not contain a special character.
Basically I was checking on my view but did not make any change on my model. My model had a Regex that was not checking for special characters. But on my view, there is script that checks if the password matches the regex.
Edit: The solution, to be more clear is to make sure the view model or class is decorated with the right Regex. Any regex check and/or validation in the view my work temporary before you try to submit your form.
In my case since I had to different regex (in my view --via jquery-- and my model), client side verification worked because I have the right regex. But server side verification did not. I had to make sure I had the right regex on my class as well.
Hope this is more clear.
I am supposed to use the regularExpressionValidator to verify a ZIP code for a basic webpage I'm making. If the Zip code is valid, the submit button's click event procedure should display the message "Your ZIP code is" followed by the ZIP code and a period.
I don't know how to do an "if" statement to check to see if the zip is valid or not
**Why does the value = 0 when I enter 60611-3456
...don't know how to do an "if" statement...
You were assigned to use a RegularExpressionValidator, and this sounds like homework. If so, it also sounds like the purpose of the assignment is to make this happen without writing any if statements at all.
The validator controls have a feature where a postback event will not occur if validation fails. You use a correct regular expression with a correctly configured validator control, and the code that shows the "Your zip code is..." message will never run. Configuring the validator control is the point of the assignment; you need to do that part on your own. But finding an acceptable regular expression is a distraction from the real learning, and so I don't mind just giving that to you:
^\d{5}(-\d{4})?$
The issue is that your regular expression indicates the four digits must exist if you have the dash. Generally that would be okay but since you're using an input mask the dash always exists, even when it's only five digits. Try the following expression.
ValidationExpression="\d{5}-?(\d{4})?$"
Hope it helps.
I have a query string parameter value that contains an ampersand. For example, a valid value for the parameter may be:
a & b
When I generate the URL that contains the parameter, I'm using System.Web.HTTPUtility.UrlEncode() to make each element URL-friendly. It's (correctly) giving me a URL like:
http://example.com/foo?bar=a+%26b
The problem is that ASP.NET's Request object is interpreting the (encoded) ampersand as a Query String parameter delimiter, and is thus splitting my value into 2 parts (the first has "bar" as the parameter name; the second has a null name).
It appears that ASP.NET is URL-decoding the URL first and then using that when parsing the query string.
What's the best way to work around this?
UPDATE: The problem hinges on URLRewriter (a third-party plugin) and not ASP.NET itself. I've changed the title to reflect this, but I'll leave the rest of the question text as-is until I find out more about the problem.
man,
i am with you in the same boat, i have spent like hours and hours trying to figure out what is the problem, and as you said it is a bug in both, as normal links that contain weird characters or UTF-8 code characters are parsed fine by asp.net.
i think we have to switch to MVC.routing
Update: man you wont believe it, i have found the problem it is so strange, it is with IIS,
try to launch your page from visual studio Dev server and Unicode characters will be parsed just fine, but if you launch the page from IIS 7 it will give you the ???? characters.
hope some body will shade some light here
I would have thought that %26 and '&' mean exactly the same thing to the web server, so its the expected behavior. Urlencode is for encoding URLs, not encoding query strings.
... hang on ...
Try searching for abc&def in google, you'll get:
http://www.google.com.au/search?q=abc%26def
So your query string is correct, %26 is a literal ampersand. Hmm you're right, sounds like a bug. How do you go with an & instead of the %26 ?
Interesting reading:
http://www.stylusstudio.com/xsllist/200104/post11060.html
Switching to UrlRewritingNet.UrlRewrite did not help, as it apparently has the same bug. I'm thinking it might have something to do with ASP.NET after all.
I think URLRewriter has a problem with nameless parameters (null name).
I had a similar problem. When I gave my nameless parameter a (dummy) name, everything worked as expected.