Last active
August 29, 2015 14:09
-
-
Save setap/a7422ea1d76356968a54 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| Public Function RgxDfx(astring As Range) As String | |
| Dim re As RegExp | |
| Dim tempString | |
| Set re = New RegExp | |
| re.Pattern = "\d+" | |
| re.Global = True | |
| re.IgnoreCase = True | |
| Set objMatches = re.Execute(astring) | |
| RgxDfx = objMatches.Item(0).Value | |
| End Function | |
| Public Function RgxCity(astring As Range) As String | |
| Dim re As RegExp | |
| Dim tempString | |
| Set re = New RegExp | |
| re.Pattern = "[(](\d+)[)]" | |
| re.Global = True | |
| re.IgnoreCase = True | |
| RgxCity = re.Replace(astring, "") | |
| End Function | |
| Public Function Rgx1stRange(astring As Range) As String | |
| Dim re As RegExp | |
| Dim tempString | |
| Set re = New RegExp | |
| re.Pattern = "(\d+)[-](\d+)" | |
| re.Global = True | |
| re.IgnoreCase = True | |
| Rgx1stRange = re.Replace(astring, "$1") | |
| End Function | |
| Public Function Rgx2stRange(astring As Range) As String | |
| Dim re As RegExp | |
| Dim tempString | |
| Set re = New RegExp | |
| re.Pattern = "(\d+)[-](\d+)" | |
| re.Global = True | |
| re.IgnoreCase = True | |
| Rgx2stRange = re.Replace(astring, "$2") | |
| End Function | |
| Public Function RgxCityFromRegion(astring As Range) As String | |
| Dim re As RegExp | |
| Dim tempString | |
| Set re = New RegExp | |
| re.Pattern = "(\S+)\s+([\S\s]+)" | |
| re.Global = True | |
| re.IgnoreCase = True | |
| RgxCityFromRegion = re.Replace(astring, "$1") | |
| End Function | |
| Public Function RgxRegionFromCity(astring As Range) As String | |
| Dim re As RegExp | |
| Dim tempString | |
| Set re = New RegExp | |
| re.Pattern = "(\S+)\s+([\S\s]+)" | |
| re.Global = True | |
| re.IgnoreCase = True | |
| RgxRegionFromCity = re.Replace(astring, "$2") | |
| End Function |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment