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:
[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:
WebCatalog for guestbook ? (1997)
Trouble with formula.db (1997)
Limiting user access to .tmpl files (1997)
Emailer (WebCat2) (1997)
select multiple (1997)
Using [Showif] tag. Mac (1997)
[cart] tag (2000)
[WAY OFF TOPIC] anybody live in Kansas? (2003)
I give up!! (1997)
[WebDNA] Writefile size limit? (2011)
multiple search commands (1997)
'Carting' into Frames (2000)
[WebDNA] sem_open solved (2012)
Webstar / WebCat - Persistent Setting (2003)
triggers.db (1999)
Fun with dates (1997)
[WebDNA] drop off not round off (2011)
PSC recommends what date format yr 2000??? (1997)
Using Cookie for client specific info? (1997)
Math Problem - Format? (1997)