I'm trying to set input mask that allows user to enter MAC-address, which consists of hex characters: 0-9, A-F.
What I get so far is:
>AA\-AA\-AA\-AA\-AA\-AA
but this format allows to enter all alphabet characters.
The question is:
How to limit input mask range with hex characters?
You can't do this with an Input Mask, but you can with the Validation Rule property shown below. It will let them enter whatever they want, but it won't let them save the data until it meets your rule.
Not Like "*[!((a-f) or (0-9))]*"
Failing to find an adequate solution, I read the instructions, and came up with the following;
To limit entry to any Hexadecimal sequence preceded by "#". i.e #FF01A2 (pink/purple?)
Caveat - Be aware that Mask and Validation rules can create ambiguity between the data viewed and the data stored. The following rules store 6 characters not 7, excluding the "#" sign from the underlying data.
Input Mask - Automatically displays the pound sign and limits all subsequent entry to any combination of 6 numbers or letters. (The ">" operator changes any letter that follows it to capital. Preceding the pound sign with a backslash or enclosing it in quotes, makes it a literal.)
Either "#">AAAAAA or \#>AAAAAA will work.
Validation Rule - Limits entry to 0-9 and a-f only. (Case is modified by the input mask above. Since the input mask above limits entry to 6 characters, use of the asterisks outside the brackets here avoids redundancy in this rule.)
Not Like "*[!0-9A-F]*"
Validation Text - Optional but recommended, to give the user some context.
Must be in hex format: 0-9, A-F only! (Will display in a standard message box.)
Access Table Field Properties - shown below.
Note: I saw a lot of examples online that included the use of "Is Null", "OR", as well as individual rules for each character - I found all of these to be a bit redundant, if they worked at all.
I achieved this in in two parts:
An input mask of >"#"AAAAAA;0;_, This ensures the user can only enter # (which is prefilled in) and then six uppercase characters.
A validation rule of Like "[#][0-9,A-F][0-9,A-F][0-9,A-F][0-9,A-F][0-9,A-F][0-9,A-F]" which ensures the field is # then six characters which are 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F.
This works very well for me and requires no VBA code.
Related
So, banging my head on the wall with a regex test site and can't seem to nail this one down.
Trying to make it so an HTML is validated to only allow 1 letter maximum, but unlimited numbers, no other characters.
W123 = valid
124X = valid
1234 = valid
WW12 = invalid
Nothing incredible here, only two possible cases:
the string starts with a digit
the string doesn't start with a digit
In the two scenari only one letter is allowed.
To express that you need a group and an alternation:
^(?:\d+[A-Z]?|[A-Z]\d)\d*$
In the two branches stored inside the group, you can see that there's at least one digit (in the first because I used the + quantifier, in the second because of \d). The first branch matches any string that starts with a digit with and without a letter (because of the optional letter [A-Z]?), the second one matches strings that start with a letter. \d* at the end of the pattern matches remaining digits.
Obviously the pattern is enclosed between anchors for the start ^ and the end of the string $.
You look for zero or more digits followed by a letter followed by zero or more digits or alternatively at least one digit.
^\d*[a-zA-Z]\d*$|^\d+$
I have column in tableau with following values:
1234
3456
6789
camp-1
camp-2
camp-3
I only want to show filter with values
camp-1
camp-2
camp-3
How can I only select the alphabetic values in filter in tableau?
Your example is not clear about what you want to include and what you want to exclude. To explain better, I took an elaborated example
Case-1 If you want to search/filter for digits at start, use this calculated field
REGEXP_MATCH([Field1], '^[0-9]')
Case-2 If you want to search for numbers anywhere, use this
REGEXP_MATCH([Field1], '(.*)[0-9]')
Case-3 If digits only are required
REGEXP_MATCH([Field1], '^[0-9]+$')
case-4 for alphabet at start use this
REGEXP_MATCH([Field1], '^[:alpha:]')
Results of all matches are shown below
Note Combining numbers anywhere AND alphabet at start you can filter out case1, case2 and case3 only.
Good Luck
If the Tableau column contains a mixture of numbers and text, the column will be a text column and all content will be considered as text. This reduces the problem to that of identifying specific rows that contain non-numeric values.
This requires some string manipulation and comparison. If you know that the structure of the content in those rows is predictable (eg the first character is always a letter when there are non numeric characters in the row) then a simple equation will filter on those rows:
if ascii(left([Text And Numbers],1) )>57 then 'text' else 'number' END
This exploits the observation that the ASCII decimal code for the digit 9 is 57 and most of the ASCII characters with higher codes are letters or punctuation (which is a fair assumption if nothing other than numbers, letters or punctuation are present in your data).
Obviously, if letters and numbers could appear anywhere in the string you need a more complex function but Tableau provides the option to use regular expressions which can code much more complex text analysis like is any alphabetic character present in a string (see this for some ideas of the appropriate regex expressions).
I am designing a membership form and want only alphabets is textbox as username.
ng-pattern="/^\d{1,10}$/"
I tried it but it not works.
The pattern you're using will only get digits
/^\d{1,10}$/"
\d{1,10} matches a digit (equal to [0-9])
{1,10} Quantifier — Matches
between 1 and 10 times, as many times as possible, giving back as
needed
$ asserts position at the end of a line
If you want only alphanumeric characters try this:
/^[a-zA-Z]*$
It will accept any character a through z -- capital or lower case.
Does anyone know how to match even numbers and odd numbers of letter using regexp in mysql? i need to match like a even number of A's followed by an odd number of G's and then at least one TC? For example: acgtccAAAAGGGTCatg would match up. It's something for dna sequencing
An even number of A's can be expressed as (AA)+ (one or more instance of AA; so it'll match AA, AAAA, AAAAAA...). An odd number of Gs can be expressed as G(GG)* (one G followed by zero or more instances of GG, so that'll match G, GGG, GGGGG...).
Put that together and you've got:
/(AA)+G(GG)*TC/
However, since regex engines will try to match as much as possible, this expression will actually match a substring of AAAGGGTC (ie. AAGGGTC)! In order to prevent that, you could use a negative lookbehind to ensure that the character before the first A isn't another A:
/(?<!A)(AA)+G(GG)*TC/
...except that MySQL doesn't support lookarounds in their regexes.
What you can do instead is specify that the pattern either starts at the beginning of the string (anchored by ^), or is preceded by a character that's not A:
/(^|[^A])(AA)+G(GG)*TC/
But note that with this pattern an extra character will be captured if the pattern isn't found at the start of the string so you'll have to chop of the first character if it's not an A.
You can maybe try something like (AA)*(GG)*GTC
I think that would do the trick. Don't know if there's a special syntax for mysql though
Is there a way to set an input mask in MS Access 2007 so that certain elements are optional? UK postcodes can be in a number of formats: LL00 0LL or L00 0LL or even LL00 L00LL. For this particular assignment, I need only worry about the first two formats.
So, is there a way for me to set the input mask so that the first letter is optional?
Found an answer here and can just use the following:
LA0# oLL
A defines a letter or digit and # defines a digit or a space and removes the space when inserted into database.
Don't bother. Just use a text field and let the users insert the blanks. Put some code in checking for approriate alphabetic vs numeric characters.
The advntage is this approach will work for any country.