Created
December 13, 2012 03:12
-
-
Save roulupen/4273732 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<cfscript> | |
request.inputString = "RajaRamMohamRoy"; | |
request.outputString = rEReplace(request.inputString, "([a-z])([A-Z])", "\1 \2", "ALL"); | |
writeOutput("<b>Input String:</b>" & request.inputString & "<br/>"); | |
writeOutput("<b>Output String:</b>" & request.outputString & "<br/>"); | |
/* | |
Here regular expression we have used is "([a-z])([A-Z])" | |
then replacing that matching pattern with "\1 \2". Which means we are searching for a string | |
which lower case and upper case letter consecutively. Like aA or bC. | |
Then we are using regular expresson back refrencing trick to add a space between these two matching pattern. | |
( #Match and Capture pattern 1 | |
[a-z] #must be a lower case alphabet | |
) #End of pattern 1 | |
( #Match and Capture pattern 2 | |
[A-Z] #must be a upper case alphabet | |
) # End of pattern 2 | |
*/ | |
</cfscript> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment