Re: [WebDNA] ONLY the FIRST continuous run of numeric chars?
This WebDNA talk-list message is from 2008
It keeps the original formatting.
numero = 101222
interpreted = N
texte = all listening to this thread :-),I see what you were suggesting Stuart (see below).Gary I did not get your drift... you put the whole match into one subpattern which then does not allow me to extract out JUST the number. Did you try either of those suggestions?Anyway, using Stuart's idea, I notice this:(notice [middle] doesn't stop on the first occurrence of "X"!?, thus the need for two layers of [middle]... but then imagine the user input (for [myString]) 3 different continuous runs of numbers... We're getting to a recursive loop/include/middle just to grab the FIRST run of continuous numeric chars, which is ridiculous!this:myString=[text show=T]myString=1155 Bluebridge, apt.#2[/text]
OldGrepDoesThis=[grep search=([^0-9]*)([0-9][0-9]*)([^0-9]*)&replace= \2][myString][/grep]
Grep1DoesThis=[text show=T]Grep1DoesThis=[grep search=([^0-9]*)([0-9] [0-9]*)([^0-9]*)&replace=\2X][myString][/grep][/text]
middleDoesThis=[Middle StartAfter=&EndBefore=X][Grep1DoesThis][/ Middle]
DoubleMiddleDoesThis=[Middle StartAfter=&EndBefore=X][Middle StartAfter=&EndBefore=X][Grep1DoesThis][/Middle][/Middle]returns:myString=1155 Bluebridge, apt.#2OldGrepDoesThis=11552Grep1DoesThis=1155X2XmiddleDoesThis=1155X2DoubleMiddleDoesThis=1155-GovindaOn Oct 20, 2008, at 3:44 PM, Stuart Tremain wrote:>> I haven't tested this, but give it a go>> [Middle EndBefore=X][grep search=([^0-9]*)([0-9][0-9]*) > ([^0-9]*)&replace=X][myString][/grep][/Middle]>>>>>> On 21/10/2008, at 8:35 AM, Govinda wrote:>>> I appreciate your time/effort Bill and Stuart!>>>> I am still stuck on this though, and I think the issue is on the >> side of WebDNA...>>>> OK, real simple, from the top:>>>> this:>> [text show=F]myString=1155 Bluebridge, apt.#2[/text]>> [grep search=([^0-9]*)([0-9][0-9]*)([^0-9]*)&replace=\2][myString][/ >> grep]>>>> is returning this:>> 11552>>>> I only want "1155". Can I do that with [grep]?>>>> -G>>>>
Associated Messages, from the most recent to the oldest:
all listening to this thread :-),I see what you were suggesting Stuart (see below).Gary I did not get your drift... you put the whole match into one subpattern which then does not allow me to extract out JUST the number. Did you try either of those suggestions?Anyway, using Stuart's idea, I notice this:(notice
[middle] doesn't stop on the first occurrence of "X"!?, thus the need for two layers of
[middle]... but then imagine the user input (for [myString]) 3 different continuous runs of numbers... We're getting to a recursive loop/include/middle just to grab the FIRST run of continuous numeric chars, which is ridiculous!this:myString=[text show=T]myString=1155 Bluebridge, apt.#2[/text]
OldGrepDoesThis=[grep search=([^0-9]*)([0-9][0-9]*)([^0-9]*)&replace= \2][myString][/grep]
Grep1DoesThis=[text show=T]Grep1DoesThis=[grep search=([^0-9]*)([0-9] [0-9]*)([^0-9]*)&replace=\2X][myString][/grep][/text]
middleDoesThis=[Middle StartAfter=&EndBefore=X][Grep1DoesThis][/ Middle]
DoubleMiddleDoesThis=[Middle StartAfter=&EndBefore=X][Middle StartAfter=&EndBefore=X][Grep1DoesThis][/Middle][/Middle]returns:myString=1155 Bluebridge, apt.#2OldGrepDoesThis=11552Grep1DoesThis=1155X2XmiddleDoesThis=1155X2DoubleMiddleDoesThis=1155-GovindaOn Oct 20, 2008, at 3:44 PM, Stuart Tremain wrote:>> I haven't tested this, but give it a go>> [Middle EndBefore=X][grep search=([^0-9]*)([0-9][0-9]*) > ([^0-9]*)&replace=X][myString][/grep][/Middle]>>>>>> On 21/10/2008, at 8:35 AM, Govinda wrote:>>> I appreciate your time/effort Bill and Stuart!>>>> I am still stuck on this though, and I think the issue is on the >> side of WebDNA...>>>> OK, real simple, from the top:>>>> this:>> [text show=F]myString=1155 Bluebridge, apt.#2[/text]>> [grep search=([^0-9]*)([0-9][0-9]*)([^0-9]*)&replace=\2][myString][/ >> grep]>>>> is returning this:>> 11552>>>> I only want "1155". Can I do that with
[grep]?>>>> -G>>>>
Govinda
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:
[WebDNA] how to make webroot the start of path (2017)
Browser Caching (2003)
[ShowCart]-- was ThankYou page problems (1997)
[quantity] within formulas (1997)
Bulletin Board (1998)
WebCat2: Items xx to xx shown, etc. (1997)
pop up menu's (1998)
[WriteFile] problems (1997)
WC 2.0 frames feature (1997)
how to use encrypt and searching (1998)
wrong input values? (1997)
Re:HTTP header line is too long? (1997)
WebCat2b13MacPlugIn - [showif][search][/showif] (1997)
downloading binary files ussing mime and tcpconnect (2004)
Problems with date math (1997)
Missing Cart Information (2003)
Re:quit command on NT (1997)
Date Sorting (1997)
WebCat B13 Mac CGI -- Frames question (1997)
Sorting by date (1997)