Regular expression for multiple words on Google forms validation - google-forms

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

Related

Google Analytics doesnt apply my filter

I created a filter on my account.
This filter is a custom filter, search and replace.
I use
"Request URI" for Filter Field,
\?.* for Search String
I also attached this filter to my specific view.
My problem is, if I go to the view->Reporting->Behavior->Site Content->All Pages, I see that the filter is not applied. I see pages such as "/xy.html?id=12345".
I would expect "/xy.html" only. Somewhere I've read that filters are not works for past data, but I did some test visits after I applied the filter and the urls wasn't changed :(
If I click on verify, I get this message: "This filter would not have changed your data. Either the filter configuration is incorrect, or the set of sampled data is too small."
Your filter definition should use regular expressions for search&replace.
Search String: (.)?(\?.)
Replace String: \1
This will search for two parts: 1. all symbols before the very first "?" 2. all symbols after the first "?" in your URI.
The replacement will use the first part as replacement (all symbols before the very first "?"
Make sure you google some regex basics.
Filters only apply the new data collected, never the historic data you already have in your properties collected.

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.

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

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

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}

Resources