Guest User

Untitled

a guest
Mar 18th, 2018
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.07 KB | None | 0 0
  1. UPDATE someTable
  2. SET someCol = regexp_replace(someCol,'(m[0-9]+)M[ ]+m([a-z]+)M','12','gi')
  3. WHERE someCol ~* 'm[0-9]+M[ ]+m[a-z]+M'
  4.  
  5. m Beginning of word
  6. ([0-9]+) 1 or more numbers, saved
  7. M End of word
  8. [ ]+ 1 or more spaces
  9. m Beginning of word
  10. ([a-z]+) 1 or more letters, saved
  11. M End of word
  12.  
  13. 12 A -> 12A
  14. 1A B -> 1A B
  15. A1 B -> A1 B
  16. 12 3 -> 12 3
  17. 12 A3 -> 12 A3
  18.  
  19. # In ArcGIS Field Calculator
  20. # split address field
  21. addresslist = address.split()
  22.  
  23. # check if last element is an alphabetic character(s) only - no numbers
  24. if addresslist[-1:].isalpha():
  25. # build new address here from address list per your requirements
  26. # this should get you started. Post back if you need help with this part.
  27.  
  28. def RemoveWhiteAfterNumber(addressField):
  29. a = addressField
  30. for i in range(10):
  31. a = a.replace( str(i) +" ", str(i))
  32. return a
  33.  
  34.  
  35.  
  36.  
  37. RemoveWhiteAfterNumber(!addressField!)
Add Comment
Please, Sign In to add comment