Re: matchChunk question

2012-01-08 Thread Peter M. Brigham, MD
On Jan 7, 2012, at 4:06 PM, Mark Smith wrote:

> 
> Peter M. Brigham, MD wrote
> 
>> Any reason not to just use
>> 
>> put numtochar(8) into tempDelim
>> replace <4-char-sequence> with tempDelim in tString
>> set the itemdelimiter to tempDelim
> 
> Thanks Peter, none that I can see although I would probably write:
> 
> put quote & "v" & quote & ":" into tempDelim -- i.e. a 4 char delimiter with
> embedded quotes
> replace tempDelim with tab in tString
> set the itemdelimiter to tab
> 
> Same idea though and much easier than fussing with replacetext and regular
> expressions. I probably didn't think this would work because of the embedded
> quotes.

Same idea. I replace  with a character that would not 
be found in any text string. Your version will work as long as there are no 
tabs already in your text.

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig



___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: matchChunk question

2012-01-07 Thread Mark Smith

Peter M. Brigham, MD wrote
> 
> Any reason not to just use
> 
> put numtochar(8) into tempDelim
> replace <4-char-sequence> with tempDelim in tString
> set the itemdelimiter to tempDelim
> 
> 

Thanks Peter, none that I can see although I would probably write:

put quote & "v" & quote & ":" into tempDelim -- i.e. a 4 char delimiter with
embedded quotes
replace tempDelim with tab in tString
set the itemdelimiter to tab

Same idea though and much easier than fussing with replacetext and regular
expressions. I probably didn't think this would work because of the embedded
quotes.

-- Mark


--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/matchChunk-question-tp4238281p4274128.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: matchChunk question

2011-12-28 Thread stephen barncard
cancel that. Read too quickly.

On 28 December 2011 13:36, stephen barncard  wrote:

> delimiters have to be single characters, I believe.  Not tested but I
> think the idea failed on me once.
>
> Stephen Barncard
>
San Francisco Ca. USA

more about sqb  
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: matchChunk question

2011-12-28 Thread stephen barncard
delimiters have to be single characters, I believe.  Not tested but I think
the idea failed on me once.

On 28 December 2011 12:00, Peter M. Brigham, MD  wrote:

> Any reason not to just use
>
> put numtochar(8) into tempDelim
> replace <4-char-sequence> with tempDelim in tString
> set the itemdelimiter to tempDelim
>
> ?
>
> -- Peter
>
> Peter M. Brigham
> pmb...@gmail.com
> http://home.comcast.net/~pmbrig
>
> On Dec 27, 2011, at 5:35 PM, Mark Smith wrote:
>
> > Thanks, worked perfectly. changing the expression to "(\" & quote & "v"
> & "\"
> > & quote & ":)" resulted in true, 422, 425 in the output. What I am
> > attempting to do is define a rather complicated item delimiter, in this
> case
> > made up of the 4 char sequence "v":  If I can define where this occurs I
> can
> > break the input up into chunks.
> >
> > Best,
> >
> > -- Mark
> >
> > --
> > View this message in context:
> http://runtime-revolution.278305.n4.nabble.com/matchChunk-question-tp4238281p4238428.html
> > Sent from the Revolution - User mailing list archive at Nabble.com.
> >
> > ___
> > use-livecode mailing list
> > use-livecode@lists.runrev.com
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>



-- 



Stephen Barncard
San Francisco Ca. USA

more about sqb  <http://www.google.com/profiles/sbarncar>
___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: matchChunk question

2011-12-28 Thread Peter M. Brigham, MD
Any reason not to just use

put numtochar(8) into tempDelim
replace <4-char-sequence> with tempDelim in tString
set the itemdelimiter to tempDelim

?

-- Peter

Peter M. Brigham
pmb...@gmail.com
http://home.comcast.net/~pmbrig

On Dec 27, 2011, at 5:35 PM, Mark Smith wrote:

> Thanks, worked perfectly. changing the expression to "(\" & quote & "v" & "\"
> & quote & ":)" resulted in true, 422, 425 in the output. What I am
> attempting to do is define a rather complicated item delimiter, in this case
> made up of the 4 char sequence "v":  If I can define where this occurs I can
> break the input up into chunks. 
> 
> Best,
> 
> -- Mark
> 
> --
> View this message in context: 
> http://runtime-revolution.278305.n4.nabble.com/matchChunk-question-tp4238281p4238428.html
> Sent from the Revolution - User mailing list archive at Nabble.com.
> 
> ___
> use-livecode mailing list
> use-livecode@lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription 
> preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: matchChunk question

2011-12-27 Thread Mark Smith
Thanks, worked perfectly. changing the expression to "(\" & quote & "v" & "\"
& quote & ":)" resulted in true, 422, 425 in the output. What I am
attempting to do is define a rather complicated item delimiter, in this case
made up of the 4 char sequence "v":  If I can define where this occurs I can
break the input up into chunks. 

Best,

-- Mark

--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/matchChunk-question-tp4238281p4238428.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


Re: matchChunk question

2011-12-27 Thread Mark Schonewille
Hi Mark,

You need to put the part of the regex that you want to know the start and end 
position of inside parantheses. In your case, this seems to be the entire regex.

--
Best regards,

Mark Schonewille

Economy-x-Talk Consulting and Software Engineering
Homepage: http://economy-x-talk.com
Twitter: http://twitter.com/xtalkprogrammer
KvK: 50277553

Become our partner in sales http://qery.us/1bq Start selling Color Converter 
today. 20% commission!

On 27 dec 2011, at 22:26, Mark Smith wrote:

> Hi, shouldn't the following place the start position and end position of the
> regular expression found in the input field into the output field?
> 
> 
> on mouseUp
>   local startpos, endpos
>   put fld"input" into tinput
>   put "\" & quote & "v" & "\" & quote & ":" into tregularexpression 
>   put matchchunk(tinput, tregularexpression, startpos, endpos) into
> fld"output"
>   put ", " & startpos & ", " & endpos after fld"output"
> end mouseUp
> 
> 
> What I am getting in output is: true, ,
> 
> With no start and end positions. Anyone see the error of my ways? Thanks
> 
> -- Mark
> 
> PS lc 5.0.2, on a Mac


___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


matchChunk question

2011-12-27 Thread Mark Smith
Hi, shouldn't the following place the start position and end position of the
regular expression found in the input field into the output field?


on mouseUp
   local startpos, endpos
   put fld"input" into tinput
   put "\" & quote & "v" & "\" & quote & ":" into tregularexpression 
   put matchchunk(tinput, tregularexpression, startpos, endpos) into
fld"output"
   put ", " & startpos & ", " & endpos after fld"output"
end mouseUp


What I am getting in output is: true, ,

With no start and end positions. Anyone see the error of my ways? Thanks

-- Mark

PS lc 5.0.2, on a Mac


--
View this message in context: 
http://runtime-revolution.278305.n4.nabble.com/matchChunk-question-tp4238281p4238281.html
Sent from the Revolution - User mailing list archive at Nabble.com.

___
use-livecode mailing list
use-livecode@lists.runrev.com
Please visit this url to subscribe, unsubscribe and manage your subscription 
preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode