sensalim Posted August 11, 2008 Share Posted August 11, 2008 (edited) I need a regexp that grabs street name (first word only) ignoring the street number. Examples: 123 Fake St --> "Fake" 456 Main Ave --> "Main" Alta Vista Blvd --> "Alta" A street Name --> "A" Thanks. Edited August 11, 2008 by sensalim Link to comment Share on other sites More sharing options...
Szhlopp Posted August 11, 2008 Share Posted August 11, 2008 (edited) I need a regexp that grabs street name (first word only) ignoring the street number. Examples: 123 Fake St --> "Fake" 456 Main Ave --> "Main" Alta Vista Blvd --> "Alta" A street Name --> "A" Thanks. (?i)[a-z]*\s|[0-9] (.*\s|.*) Edited August 11, 2008 by Szhlopp RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
sensalim Posted August 12, 2008 Author Share Posted August 12, 2008 (edited) Thanks but I changed the criteria...Here's the new one.starts with any number or not...then after that, anything.I came up with this but it's not perfect...[\s]*[^0-9]+[0-9]*This will do except this string "39 main 2 ave"the " ave" is not included in the first match set... and I need it to.Any help?Thanks.Edit:This might do it.[\s]*[^0-9]+.*What do you think?Btw I use this website http://gskinner.com/RegExr/ to test Edited August 12, 2008 by sensalim Link to comment Share on other sites More sharing options...
Szhlopp Posted August 12, 2008 Share Posted August 12, 2008 Thanks but I changed the criteria... Here's the new one. starts with any number or not... then after that, anything. I came up with this but it's not perfect... [\s]*[^0-9]+[0-9]* This will do except this string "39 main 2 ave" the " ave" is not included in the first match set... and I need it to. Any help? Thanks. Edit: This might do it. [\s]*[^0-9]+.* What do you think? Btw I use this website http://gskinner.com/RegExr/ to test Give me 4 cases like you did in the original post. All cases being somewhat different in how they are typed. And with each case, what you want returned RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
sensalim Posted August 12, 2008 Author Share Posted August 12, 2008 "123 main st" --> " main st" "main dr." --> "main dr." "440 N Claude Blvd" --> " N Claude Blvd" "??S??" --> "??S??" "POBox811" --> "POBox811" "P.O. Box 555" --> "P. O. Box 555" "39 C o r d 2 ave" --> " C o r d 2 ave" "2605S.Reith Ln" --> "S.Reith Ln" "123 P,O, Box 456" --> " P, O, Box 456" "789P OBox000" --> "P OBox 000" Link to comment Share on other sites More sharing options...
Szhlopp Posted August 12, 2008 Share Posted August 12, 2008 (edited) "123 main st" --> " main st" "main dr." --> "main dr." "440 N Claude Blvd" --> " N Claude Blvd" "??S??" --> "??S??" "POBox811" --> "POBox811" "P.O. Box 555" --> "P. O. Box 555" "39 C o r d 2 ave" --> " C o r d 2 ave" "2605S.Reith Ln" --> "S.Reith Ln" "123 P,O, Box 456" --> " P, O, Box 456" "789P OBox000" --> "P OBox 000" ([0-9]*)?\s?(.*) Element 1 is the key=) Or simpler [^0-9].* Edited August 12, 2008 by Szhlopp RegEx/RegExRep Tester!Nerd Olympics - Community App!Login UDFMemory UDF - "Game.exe+753EC" - CE pointer to AU3Password Manager W/ SourceDataFiler - Include files in your au3!--- Was I helpful? Click the little green '+' Link to comment Share on other sites More sharing options...
sensalim Posted August 12, 2008 Author Share Posted August 12, 2008 Yes thanks. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now