Regex to make last letter capital [duplicate] - regex

This question already has an answer here:
Learning Regular Expressions [closed]
(1 answer)
Closed 4 years ago.
SO i got regex to make first letter capital but i need now a regex to make the last letter caps, ive tried google searches and came up with nothing
Example of what im talking about
razor123
james333
firefire32923932
laser
Need them to turn into
razoR123
jameS333
firefirE32923932
laseR

Try this:
Find: ^([a-z]+)([a-z][^a-z]*)$
Replace with: \1\U\2

Related

Remove Everything after a specific word using R [duplicate]

This question already has answers here:
Remove part of string after "."
(6 answers)
Closed 2 years ago.
As the image shows, I need to remove everything after the word "Please" irrespective of the position of word "Please".
I tried regex to remove everything after ".", I need different approach for this
Any help will be appreciated.
Please try this regexp (\bPlease\b)(?!.*\1)
https://regex101.com/r/9wWAlG/1

Regex Extract on Google Sheets [duplicate]

This question already has an answer here:
Reference - What does this regex mean?
(1 answer)
Closed 3 years ago.
I am trying to find an expression that can be used extract a string after a specific number of characters.
E.g
FR_EN_BR_Student_Exact
FR_EN_NB_Student_Exact
I would want a pattern that can take all characters past the second underscore ( not including the underscore.
Would appreciate any ideas!
I understand basic regex but am having trouble with this specific query.
try:
=ARRAYFORMULA(IFNA(REGEXEXTRACT(A1:A, ".+_.+_(.+_.+_.+)")))

Check if a word appears twice with regex [duplicate]

This question already has answers here:
Check if word exists twice? (Regex) [closed]
(5 answers)
Closed 4 years ago.
I want to check with regex if the word link appears twice in a sentence.
The sentence goes: "This link is invalid. Try the link below." --> here I need the regex to check if "link" appears twice.
This is my first time trying regex and I only understood the grouping so far like \b(link)\b. With this I can check if the word link even appears but I need to know if it appears twice.
How can I achieve this?
Try this one:
\b(link)\b(?=.*\b\1\b)
This gives you the first occurrence of the duplicate word.
Tested it with your sentence here: https://regex101.com/r/2zGSKj/2
A shorter solution without groups would simply be
\blink\b.*\blink\b
Tested it here: https://regex101.com/r/2zGSKj/3

validation format - Reges expression [duplicate]

This question already has answers here:
How do I match an entire string with a regex?
(8 answers)
Closed 5 years ago.
I believe my validation is correct however it is not working.
My regular expression pattern is
ValidationExpression= "(I|II|III|IV)[DEF]?"
Basically, the user should put any of the first options then with optional D, E or F
Valid text Example: IIIC
Thank you
I don't know much about regex, but I did a quick bit of googling and came up with this:
https://regex101.com/r/KYpVbk/1
It explains how it works at the side :)

Regular expression - For swapping text after and before underscore [duplicate]

This question already has an answer here:
Reference - What does this regex mean?
(1 answer)
Closed 5 years ago.
I have a bunch of file names like this a1_b2_c3_d4.png but I want them to renamed like this a1_b2_d4_c3.png. I am having NameChanger application to implement regex on file names. I could not figure out regex to swap c3 and d4. If anyone can help me with the regex, that will be great.
There are three permutations to what you ask:
If you only care about the last 2 before the dot
find ([^._]+)_([^._]+)\.
replace $2_$1.
If it has to be exactly the 3 rd or 4 th before the dot
find ^([^._]+_[^._]+_)([^._]+)_([^._]+)\.
replace $1$3_$2.
If it has to be exactly the 3 rd or 4 th without dot
find ^([^._]+_[^._]+_)([^._]+)_([^._]+)
replace $1$3_$2