Authohotkey doesn't have an option in StringUpper to capitalize letters after an hyphen (HINT: request).
This rock-hard cake => This Rock-hard Cake
vs
This rock-hard cake => This Rock-Hard Cake
How do I uppercase all letters after an hyphen: [a-z]-[a-z] => [a-z]-[A-Z]
RegExReplace(aString, "[a-z]\-([a-z])", "$U1")
or
RegExReplace(aString, "\-([a-z])", "$U1")
RegExReplace & Uppercase Topic is solved
Re: RegExReplace & Uppercase
Code: Select all
MsgBox % RegExReplace( "brown-fox jumps-over", "([a-z]\-)([a-z])", "$1$U2")
Re: RegExReplace & Uppercase
The example works, but this doesn't:
Code: Select all
RegExReplace(aString, "([a-z]\-)([a-z])", "$1$U2")
Re: RegExReplace & Uppercase
Example with string works, but this doesn't:
But adding "MsgBox %" before code above works.
Since I'm using the RegExReplace inside a function, how to I make the changes to the variable so I can send it back as the result?
Code: Select all
RegExReplace(aString, "([a-z]\-)([a-z])", "$1$U2")
Since I'm using the RegExReplace inside a function, how to I make the changes to the variable so I can send it back as the result?
Code: Select all
RegExReplace(aString,"([a-z]\-)([a-z])","$1$U2")
Return aString
Last edited by keyes on 28 Jun 2017, 07:16, edited 1 time in total.
Re: RegExReplace & Uppercase Topic is solved
what's aString ?
Re: RegExReplace & Uppercase
of course it works, you just need to assign it back to a variable (can be the same) just call RegExReplace() on its own doesn't change the contents of the string
Code: Select all
aString:="brown-fox jumps-over"
aString:=RegExReplace(aString, "([a-z]\-)([a-z])", "$1$U2")
MsgBox % aString
Re: RegExReplace & Uppercase
Code: Select all
Return RegExReplace(aString,"([a-z]\-)([a-z])","$1$U2")
Re: RegExReplace & Uppercase
aString = variable that contains selected text (example: "the brown-fox in house")
1) StringUpper(aString) => "The Brown-fox In House"
2) myPrepositionsFix(aString) => "The Brown-fox in House"
aString => "The Brown-Fox in House"
Needed to assign result of RegExReplace this way: aString = % RegExReplace()
1) StringUpper(aString) => "The Brown-fox In House"
2) myPrepositionsFix(aString) => "The Brown-fox in House"
Code: Select all
aString = % RegExReplace(aString,"(\-)([a-z])","$1$U2")
Needed to assign result of RegExReplace this way: aString = % RegExReplace()
Last edited by keyes on 28 Jun 2017, 07:51, edited 4 times in total.
Re: RegExReplace & Uppercase
RegEx is not the point here.
Read the Help file.
Expression section.
That is really dirty part of AHK.
Should be fixed.
Read the Help file.
Expression section.
That is really dirty part of AHK.
Should be fixed.
Re: RegExReplace & Uppercase
Never used RegEx in Autohotkey before so missed the assignment detail.
I see your point.
I see your point.
Who is online
Users browsing this forum: Spawnova and 260 guests