Re: [WebDNA] ONLY the FIRST continuous run of numeric chars?

This WebDNA talk-list message is from

2008


It keeps the original formatting.
numero = 101228
interpreted = N
texte = [grep search=[^0-9]*([0-9][0-9]*).*|.*&replace=\1][myString][/grep] This will work to ignore the case where no number is in the string. It will return an apartment number if there is no street number. On Tue, Oct 21, 2008 at 12:16 AM, Govinda wrote: > Bill, > > that is the best behaved [grep] yet for this problem! > Thanks. > > Note though, that if there are NO numbers in [myString], then it returns the > whole string... (sigh). (And I was bad enough at the regex engines that > behave as expected!) > > for the final check I am just multiplying the result of the [grep] by zero > and seeing if the result = 0 ==> i.e. we have a number. > > On Oct 20, 2008, at 8:22 PM, William DeVaul wrote: > >> [text show=F]myString=1155 Bluebridge, apt.#2[/text] >> [grep search=[^0-9]*([0-9][0-9]*).*&replace=\1][myString][/grep] >> >> The above works in the situation you've described, namely the first >> number of 1 or more digits returned and nothing else. >> >> I'm not sure why you wanted the other text for back reference. >> >> To the question below, WebDNA regex does not handle one or more, i.e. >> +, the way you'd expect. The workaround is to repeat the reference. >> >> Bill >> > --------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us > old archives: http://dev.webdna.us/TalkListArchive/ > Associated Messages, from the most recent to the oldest:

    
  1. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? ("William DeVaul" 2008)
  2. RE: [WebDNA] ONLY the FIRST continuous run of numeric chars? ("Michael A. DeLorenzo" 2008)
  3. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? (Matthew Bohne 2008)
  4. RE: [WebDNA] ONLY the FIRST continuous run of numeric chars? ("Michael A. DeLorenzo" 2008)
  5. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? (Gary Krockover 2008)
  6. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? (Matthew Bohne 2008)
  7. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? (Govinda 2008)
  8. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? ("William DeVaul" 2008)
  9. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? (Govinda 2008)
  10. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? ("William DeVaul" 2008)
  11. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? (Govinda 2008)
  12. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? (Govinda 2008)
  13. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? ("Gary Krockover" 2008)
  14. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? (Govinda 2008)
  15. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? (Patrick McCormick 2008)
  16. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? (Terry Wilson 2008)
  17. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? (Charles Kline 2008)
  18. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? ("Gary Krockover" 2008)
  19. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? ("Gary Krockover" 2008)
  20. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? (Stuart Tremain 2008)
  21. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? (Govinda 2008)
  22. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? (Stuart Tremain 2008)
  23. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? ("William DeVaul" 2008)
  24. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? (Govinda 2008)
  25. Re: [WebDNA] ONLY the FIRST continuous run of numeric chars? (Stuart Tremain 2008)
  26. [WebDNA] ONLY the FIRST continuous run of numeric chars? (Govinda 2008)
[grep search=[^0-9]*([0-9][0-9]*).*|.*&replace=\1][myString][/grep] This will work to ignore the case where no number is in the string. It will return an apartment number if there is no street number. On Tue, Oct 21, 2008 at 12:16 AM, Govinda wrote: > Bill, > > that is the best behaved [grep] yet for this problem! > Thanks. > > Note though, that if there are NO numbers in [myString], then it returns the > whole string... (sigh). (And I was bad enough at the regex engines that > behave as expected!) > > for the final check I am just multiplying the result of the [grep] by zero > and seeing if the result = 0 ==> i.e. we have a number. > > On Oct 20, 2008, at 8:22 PM, William DeVaul wrote: > >> [text show=F]myString=1155 Bluebridge, apt.#2[/text] >> [grep search=[^0-9]*([0-9][0-9]*).*&replace=\1][myString][/grep] >> >> The above works in the situation you've described, namely the first >> number of 1 or more digits returned and nothing else. >> >> I'm not sure why you wanted the other text for back reference. >> >> To the question below, WebDNA regex does not handle one or more, i.e. >> +, the way you'd expect. The workaround is to repeat the reference. >> >> Bill >> > --------------------------------------------------------- > This message is sent to you because you are subscribed to > the mailing list . > To unsubscribe, E-mail to: > archives: http://mail.webdna.us/list/talk@webdna.us > old archives: http://dev.webdna.us/TalkListArchive/ > "William DeVaul"

DOWNLOAD WEBDNA NOW!

Top Articles:

Talk List

The WebDNA community talk-list is the best place to get some help: several hundred extremely proficient programmers with an excellent knowledge of WebDNA and an excellent spirit will deliver all the tips and tricks you can imagine...

Related Readings:

Announce: Bug fix talk list (1999) problem 'building' field names (2000) Access Denied! But why? (1997) [OT] HTML lists and IE (2007) [format 40s]text[/format] doesn't work (1997) Email within tmpl ? (1997) Hosts who have upgraded to v5.0? (2003) MD5 Encryption (2003) when is date system date or order date? (1997) Webmerchant (1999) problems with 2 tags (1997) WebCat2b14MacPlugIn - [include] doesn't hide the search string (1997) RE: Migrating to NT (1997) Not accepting Zero (2000) PCS Frames (1997) Shopping Cart Best Practices (2006) Math Problem - Format? (1997) Exclamation point (1997) MATH TIME (1997) passing search criteria (1997)