This question already has answers here:
Regular Expression only match if String ends with target
(3 answers)
Closed 2 years ago.
Hello I'm having a little problem with getting the last 32 random digits and numbers (ID)
here's the example links
LINK 1: https://www.testurl/9c47c746-21e6-457a-a557-e5f93bdfff05/056c623a-9327-40d2-8ed7-c349dac76f0d
LINK 2: https://www.testurl/a08e9b68-e65b-4beb-b112-fd4360915e82
here's the Regex I'm using:
(it's only match the first 32 random digits and numbers which is from LINK 2)
(\w{8}-\w{4}-\w{4}-\w{4}-\w{12})
I also want to get only the "056c623a-9327-40d2-8ed7-c349dac76f0d" from the "LINK 1" after the slash
Thank you #41686d6564
answer:
\b\w{8}-\w{4}-\w{4}-\w{4}-\w{12}$
Related
This question already has answers here:
Reference - What does this regex mean?
(1 answer)
Learning Regular Expressions [closed]
(1 answer)
Closed 2 years ago.
Actually i am just beginer to learn regex but now i have a problem.
Can somebody help me to create regex for the follwing condtions:
Text lenght should be 6
1st character should be in Caps
2nd character should be in lower
3rd character should be numeric
4th character should be in lower again
5th character should be in Caps again
6th character should be in numeric again
But shouldn't contain any special character
You can do it pretty easily.
([A-Z][a-z]\d{1}[a-z][A-Z]\d{1})
This question already has answers here:
C# Find a matching string by regex
(5 answers)
How do I match an entire string with a regex?
(8 answers)
Closed 3 years ago.
I have a table element 'ClassTable' which contains text as follows:
"Class Name\r\nCreated By\r\nClass Type\r\nClass Code\r\nMathematics Grade 6\r\nTeacher1\r\nSchool\r\n7BD6231E\r\nManage"
The above text contains a random 8 digit Hex code 7BD6231E which changes after each validation.
Is there any way to match the whole text using Selenium WebDriver or C# with Regex like [A-F0-9]{8} for the random hex code so that my validation passes every time without any issues as the Hex Code will change every time.
I have tried the Regex [A-F0-9]{8} with ClassTable.Text.Contains function as follows but I guess Regex is not supported in Text.Contains function.
ClassTable.Text.Contains("Class Name\r\nCreated By\r\nClass Type\r\nClass Code\r\nMathematics Grade 6\r\nTeacher1\r\nSchool\r\n[A-F0-9]{8}\r\nManage");
The suggested solutions should match the whole text including the random Hex Code. Thanks.
This question already has answers here:
Regex to match 10 or 12 digits only
(3 answers)
Closed 4 years ago.
I'm new to C# and coming from PHP background.
I wanted to validate only 10 and 12 digits only with following regex statment.
I got correct regex. But still I'm getting invalid number error if tested
Pleae point me out where I do the mistake here.
Code is compiled without any issues.
// To validate 10 digits or 10 digits only
string regxstr = "^(?=[0-9]*$)(?:.{10}|.{12})$";
if (Regex.IsMatch(Data.number, regxstr))
{
return "Valid number";
}
else {
return "Invalid number";
}
Your testing data does not consists of only digits.
You could simplify your regex to match 10 digits \d{10} with and optional group that matches 2 digits (?:\d{2})?.
^\d{10}(?:\d{2})?$
Demo
I wonder why don't you use simple regular expression for this like:
^(\d{10}|\d{12})$
This question already has an answer here:
Reference - What does this regex mean?
(1 answer)
Closed 8 years ago.
I have this piece of code but have no idea what it is supposed to be matching. I have looked at many different sites to try and learn the keywords, but I just don't understand regex.
string key = #"^(.*)\s*=\s*(.*)\s*$";
Match value = Regex.Match(line, key);
This looks for the start of a line (^), finds any number of characters ((.*)), followed by some whitespace (\s*) an equal sign (=) some more whitespace (\s*) and any number of characters ((.*)) and the end of line ($)
Some valid example lines:
a=a
abc = xyz
value=5
etc
This question already has answers here:
Is it possible to pad integers with zeros using regular expressions?
(2 answers)
Closed 9 years ago.
I am trying to display a code like ABC/DEF/00012 or ABC/EDF/01234 or ABC/DEF/00009
I use RegEx mask \w{3}/\w{3}/?????
The question mark is hard part that I could not figure it out.
Basically, I try to display the code with characters and numbers. I want to automatically add leading zeros on the number.
Byron
Seems that you're trying to match 5 digits at the end:
\w{3}/\w{3}/\d{5}