Regular field expression to validate alpha-numeric values,#and dot - asp.net

How can I customize regular expression to allow alpha-numeric values,# and dot.
I want this expression for the field user name. So it should allow only those values that are present in usual usernames.
Thanks in advance...

What you're asking for in your question is:
ValidationExpression="^[a-zA-Z0-9.#]{0,25}$"
But I would suggest you to use this one:
xyz\\\\[a-zA-Z]\d[a-zA-Z]\d{4}

Related

Regular expression for multiple words on Google forms validation

Simply I would like to add some answers that can't be answered by the submitter or user
I want a Regular expression for multiple words on Google forms validation
How to write a regular expression or a pattern for that matter
I've tried that
(Student Name 1|Student Name 2|Student Name 3)
With and without brackets
And the response just prevent the whole string like it isn't a regular expression

how can I join two regex into one?

I have two regex that I need to join into one as I am using the RegularExpressionAttribute in ASP.NET and it does not allow multiple instances.
How can I join the following two regex into one?
.*?#(?!.*?\.\.)[^#]+$
[\x00-\x7F]
the first one checks that there are not 2 consecutive dots in the domain part of an email and the second regex checks that all characters are ascii
I thought it might have been as easy as joining them together like (.*?#(?!.*?\.\.)[^#]+$)([\x00-\x7F]) but this does not work
Here is link to previous post relating to this problem
EDIT: I am decorating an string property of my viewmodel using reglarexpression attribute and this gets rendered into javascript using unobtrusive therefore it has to validate using javascript. I failed to mention this in my initial post
You can use:
^[\x00-\x7F]+?#(?!.*?\.\.)(?=[\x01-\x7F]+$)[^#]+$
You can just use this regex
^[\x00-\x7F-[#]]*?#(?!.*?\.\.)[\x00-\x7F-[#]]+$
Or, if you want to match at least 1 character before #:
^[\x00-\x7F]+#(?!.*?\.\.)[\x00-\x7F-[#]]+$
Mind that [\x00-\x7F] also includes # symbol. In C# regex, we can subtract this from the range using -[#] inside the character class.
And you do not need the anchors since you are using this in a RegularExpressionAttribute, I believe.
Here is a demo on regexstorm.net, remove the second #, and you will have a match.

How do I exclude multiple terms in Kibana 4

How can I exclude multiple search terms in Kibana 4? If I type in only one term, it excludes it...but how can I have more than one excluded term. For example, the term "not yet classified"
If I understand your question properly, you're trying to use the "Exclude Pattern" to exclude certain values from populating in the chart.
The "Exclude Pattern" and "Include Pattern" fields are for Regular Expressions and are documented here: http://docs.oracle.com/javase/7/docs/api/java/util/regex/Pattern.html.
If you want to exclude multiple fields, you could do something like this:
term1|term2|term3
The query field in Kibana uses Lucene syntax which has some info at http://www.lucenetutorial.com/lucene-query-syntax.html.
To exclude a term containing specific text, use
-field: "text"
to exclude different texts, I use
-field: ("text1" or "text2")
If it's two separate fields, try
-field1: "text1" -field2: "text2"
in newer version of kibana if you want to exclude some term use this:
not field : "text"
if you want to exclude a phrase use this:
not field : "some text phrase"
you can use other logical operation with not:
field: "should have phrase" and not field: "excluded phrase"
https://www.elastic.co/guide/en/kibana/master/kuery-query.html
To match documents where response is 200 but extension is not php or css.
response:200 and not (extension:php or extension:css)
So in the query above the visualization, you can use Lucene syntax to exclude the hits, once saved this will perform the same as an attempt of using regex or Lucene syntax in the Exclude Field of the Buckets advanced options.

asp.net regular expression validator for email or numeric

Is it possible use a regular expression validator for a textbox which accepts either user email or phone number (11 digits number which begins with 09) ?
so one regex is needed which accepts one of two cases, email or number.
For Email : "\w+([-+.']\w+)#\w+([-.]\w+).\w+([-.]\w+)*"
[0][9][0-9]

regular expression for a text box that is not required, but needs to validate if entered

On my form I have a text box for a phone number. I have a regular expression that is fairly universal & can accept almost every variation for a phone number, local or international. the expression is as follows:
^((+)?[1-9]{1,2})?([-\s.])?(((\d{1,4}))|\d{1,4})(([-\s.])?[0-9]{1,12}){1,2}(x?[0-9]{1,})?$
The issue is, the field is not required, but needs to be validated if they decide to enter a number. is there any possible way of doing this?
Surround the entire regex, except the ^ and $ with an extra ( )?
^(((+)?[1-9]{1,2})?([-\s.])?(((\d{1,4}))|\d{1,4})(([-\s.])?[0-9]{1,12}){1,2}(x?[0-9]{1,})?)?$
I don't do ASP programming, but couldn't you do some sort of condition that says something like:
if( textbox.value.length > 0 ) then validate
So it only validates if the user entered something

Resources