filter? replace? wildcard? reg exp? help please!

classic Classic list List threaded Threaded
16 messages Options
Reply | Threaded
Open this post in threaded view
|

filter? replace? wildcard? reg exp? help please!

Sannyasin Brahmanathaswami via use-livecode
Given this snippet...

-------------------------------------------------------
CANTO XXXIV
CÍRCULO IX: TRAIDORES.
«Vexilla regis prodeunt[307] del Abismo
hacia nosotros[308], mas delante mira
3—dijo el maestro— y los verás tú mismo.»
-------------------------------------------------------

... how do I use LC to remove the square-brackets and any string within
them, so that the snippet becomes...

-------------------------------------------------------
CANTO XXXIV
CÍRCULO IX: TRAIDORES.
«Vexilla regis prodeunt del Abismo
hacia nosotros, mas delante mira
3—dijo el maestro— y los verás tú mismo.»
-------------------------------------------------------

Muchas gracias.

--
Nicolás Cueto
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: filter? replace? wildcard? reg exp? help please!

Sannyasin Brahmanathaswami via use-livecode
use offset.

Peter


On May 9, 2017, at 8:41 PM, Nicolas Cueto via use-livecode <[hidden email]> wrote:

> Given this snippet...
>
> -------------------------------------------------------
> CANTO XXXIV
> CÍRCULO IX: TRAIDORES.
> «Vexilla regis prodeunt[307] del Abismo
> hacia nosotros[308], mas delante mira
> 3—dijo el maestro— y los verás tú mismo.»
> -------------------------------------------------------
>
> ... how do I use LC to remove the square-brackets and any string within
> them, so that the snippet becomes...
>
> -------------------------------------------------------
> CANTO XXXIV
> CÍRCULO IX: TRAIDORES.
> «Vexilla regis prodeunt del Abismo
> hacia nosotros, mas delante mira
> 3—dijo el maestro— y los verás tú mismo.»
> -------------------------------------------------------
>
> Muchas gracias.
>
> --
> Nicolás Cueto
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: filter? replace? wildcard? reg exp? help please!

Sannyasin Brahmanathaswami via use-livecode
Try—
put your text into tText, then

repeat forever
        if offset("[",tText) is not empty then
                delete char (offset("[",tText)) to (offset("]",tText)) of tText
        else
        exit repeat
end repeat



On May 9, 2017, at 8:54 PM, Peter Bogdanoff via use-livecode <[hidden email]> wrote:

> use offset.
>
> Peter
>
>
> On May 9, 2017, at 8:41 PM, Nicolas Cueto via use-livecode <[hidden email]> wrote:
>
>> Given this snippet...
>>
>> -------------------------------------------------------
>> CANTO XXXIV
>> CÍRCULO IX: TRAIDORES.
>> «Vexilla regis prodeunt[307] del Abismo
>> hacia nosotros[308], mas delante mira
>> 3—dijo el maestro— y los verás tú mismo.»
>> -------------------------------------------------------
>>
>> ... how do I use LC to remove the square-brackets and any string within
>> them, so that the snippet becomes...
>>
>> -------------------------------------------------------
>> CANTO XXXIV
>> CÍRCULO IX: TRAIDORES.
>> «Vexilla regis prodeunt del Abismo
>> hacia nosotros, mas delante mira
>> 3—dijo el maestro— y los verás tú mismo.»
>> -------------------------------------------------------
>>
>> Muchas gracias.
>>
>> --
>> Nicolás Cueto
>> _______________________________________________
>> use-livecode mailing list
>> [hidden email]
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: filter? replace? wildcard? reg exp? help please!

Sannyasin Brahmanathaswami via use-livecode
In reply to this post by Sannyasin Brahmanathaswami via use-livecode
On 5/9/17 10:41 PM, Nicolas Cueto via use-livecode wrote:

> Given this snippet...
>
> -------------------------------------------------------
> CANTO XXXIV
> CÍRCULO IX: TRAIDORES.
> «Vexilla regis prodeunt[307] del Abismo
> hacia nosotros[308], mas delante mira
> 3—dijo el maestro— y los verás tú mismo.»
> -------------------------------------------------------
>
> ... how do I use LC to remove the square-brackets and any string within
> them, so that the snippet becomes...
>
> -------------------------------------------------------
> CANTO XXXIV
> CÍRCULO IX: TRAIDORES.
> «Vexilla regis prodeunt del Abismo
> hacia nosotros, mas delante mira
> 3—dijo el maestro— y los verás tú mismo.»
> -------------------------------------------------------

This is about the only thing I know how to do with regext. :)

on fix
   put fld 1 into tText
   put "\[.*\]" into tRegEx
   put replacetext(tText,tRegEx,empty) into fld 2
end fix

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: filter? replace? wildcard? reg exp? help please!

Sannyasin Brahmanathaswami via use-livecode
In reply to this post by Sannyasin Brahmanathaswami via use-livecode
There is probably an easier way, but this works:

    on mouseUp
         put "]" & field 1 into tText
         set the lineDelimiter to "["
         set the itemDelimiter to "]"
         repeat for each line tLine in tText
             put item 2 to -1 of tLine after tNewText
         end repeat
         put tNewText into field 2
    end mouseUp

HTH -
Phil Davis


On 5/9/17 8:41 PM, Nicolas Cueto via use-livecode wrote:

> Given this snippet...
>
> -------------------------------------------------------
> CANTO XXXIV
> CÍRCULO IX: TRAIDORES.
> «Vexilla regis prodeunt[307] del Abismo
> hacia nosotros[308], mas delante mira
> 3—dijo el maestro— y los verás tú mismo.»
> -------------------------------------------------------
>
> ... how do I use LC to remove the square-brackets and any string within
> them, so that the snippet becomes...
>
> -------------------------------------------------------
> CANTO XXXIV
> CÍRCULO IX: TRAIDORES.
> «Vexilla regis prodeunt del Abismo
> hacia nosotros, mas delante mira
> 3—dijo el maestro— y los verás tú mismo.»
> -------------------------------------------------------
>
> Muchas gracias.
>
> --
> Nicolás Cueto
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode

--
Phil Davis

_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: filter? replace? wildcard? reg exp? help please!

Sannyasin Brahmanathaswami via use-livecode
In reply to this post by Sannyasin Brahmanathaswami via use-livecode
​Thank you everyone. Went with ​Jacqueline's, cause fastest.

--
N. Cueto
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: filter? replace? wildcard? reg exp? help please!

Sannyasin Brahmanathaswami via use-livecode
In reply to this post by Sannyasin Brahmanathaswami via use-livecode
On 5/9/17 11:16 PM, J. Landman Gay via use-livecode wrote:

> On 5/9/17 10:41 PM, Nicolas Cueto via use-livecode wrote:
>> Given this snippet...
>>
>> -------------------------------------------------------
>> CANTO XXXIV
>> CÍRCULO IX: TRAIDORES.
>> «Vexilla regis prodeunt[307] del Abismo
>> hacia nosotros[308], mas delante mira
>> 3—dijo el maestro— y los verás tú mismo.»
>> -------------------------------------------------------
>>
>> ... how do I use LC to remove the square-brackets and any string within
>> them, so that the snippet becomes...
>>
>> -------------------------------------------------------
>> CANTO XXXIV
>> CÍRCULO IX: TRAIDORES.
>> «Vexilla regis prodeunt del Abismo
>> hacia nosotros, mas delante mira
>> 3—dijo el maestro— y los verás tú mismo.»
>> -------------------------------------------------------
>
> This is about the only thing I know how to do with regext. :)
>
> on fix
>   put fld 1 into tText
>   put "\[.*\]" into tRegEx
>   put replacetext(tText,tRegEx,empty) into fld 2
> end fix
>

You'd probably want it to be a function though:

function removeBrackets pString
   return replacetext(pString,"\[.*\]",empty)
end removeBrackets

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: filter? replace? wildcard? reg exp? help please!

Sannyasin Brahmanathaswami via use-livecode
Totally OT, but is this Dante, in Spanish??

Just askin’. I am not good with languages, as you can probably tell.

Graham

> On 10 May 2017, at 06:33, J. Landman Gay via use-livecode <[hidden email]> wrote:
>
> On 5/9/17 11:16 PM, J. Landman Gay via use-livecode wrote:
>> On 5/9/17 10:41 PM, Nicolas Cueto via use-livecode wrote:
>>> Given this snippet...
>>>
>>> -------------------------------------------------------
>>> CANTO XXXIV
>>> CÍRCULO IX: TRAIDORES.
>>> «Vexilla regis prodeunt[307] del Abismo
>>> hacia nosotros[308], mas delante mira
>>> 3—dijo el maestro— y los verás tú mismo.»
>>> -------------------------------------------------------
>>>
>>> ... how do I use LC to remove the square-brackets and any string within
>>> them, so that the snippet becomes...
>>>
>>> -------------------------------------------------------
>>> CANTO XXXIV
>>> CÍRCULO IX: TRAIDORES.
>>> «Vexilla regis prodeunt del Abismo
>>> hacia nosotros, mas delante mira
>>> 3—dijo el maestro— y los verás tú mismo.»
>>> -------------------------------------------------------
>>
>> This is about the only thing I know how to do with regext. :)
>>
>> on fix
>>  put fld 1 into tText
>>  put "\[.*\]" into tRegEx
>>  put replacetext(tText,tRegEx,empty) into fld 2
>> end fix
>>
>
> You'd probably want it to be a function though:
>
> function removeBrackets pString
>  return replacetext(pString,"\[.*\]",empty)
> end removeBrackets
>
> --
> Jacqueline Landman Gay         |     [hidden email]
> HyperActive Software           |     http://www.hyperactivesw.com
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: filter? replace? wildcard? reg exp? help please!

Sannyasin Brahmanathaswami via use-livecode
> Totally OT, but is this Dante, in Spanish??

Yes, and yes. From the verse translation of Ángel Crespo.

--
Nicolas Cueto

On 10 May 2017 at 19:57, Graham Samuel via use-livecode <
[hidden email]> wrote:

> Totally OT, but is this Dante, in Spanish??
>
> Just askin’. I am not good with languages, as you can probably tell.
>
> Graham
>
> > On 10 May 2017, at 06:33, J. Landman Gay via use-livecode <
> [hidden email]> wrote:
> >
> > On 5/9/17 11:16 PM, J. Landman Gay via use-livecode wrote:
> >> On 5/9/17 10:41 PM, Nicolas Cueto via use-livecode wrote:
> >>> Given this snippet...
> >>>
> >>> -------------------------------------------------------
> >>> CANTO XXXIV
> >>> CÍRCULO IX: TRAIDORES.
> >>> «Vexilla regis prodeunt[307] del Abismo
> >>> hacia nosotros[308], mas delante mira
> >>> 3—dijo el maestro— y los verás tú mismo.»
> >>> -------------------------------------------------------
> >>>
> >>> ... how do I use LC to remove the square-brackets and any string within
> >>> them, so that the snippet becomes...
> >>>
> >>> -------------------------------------------------------
> >>> CANTO XXXIV
> >>> CÍRCULO IX: TRAIDORES.
> >>> «Vexilla regis prodeunt del Abismo
> >>> hacia nosotros, mas delante mira
> >>> 3—dijo el maestro— y los verás tú mismo.»
> >>> -------------------------------------------------------
> >>
> >> This is about the only thing I know how to do with regext. :)
> >>
> >> on fix
> >>  put fld 1 into tText
> >>  put "\[.*\]" into tRegEx
> >>  put replacetext(tText,tRegEx,empty) into fld 2
> >> end fix
> >>
> >
> > You'd probably want it to be a function though:
> >
> > function removeBrackets pString
> >  return replacetext(pString,"\[.*\]",empty)
> > end removeBrackets
> >
> > --
> > Jacqueline Landman Gay         |     [hidden email]
> > HyperActive Software           |     http://www.hyperactivesw.com
> >
> >
> > _______________________________________________
> > use-livecode mailing list
> > [hidden email]
> > Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> > http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> [hidden email]
> Please visit this url to subscribe, unsubscribe and manage your
> subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: filter? replace? wildcard? reg exp? help please!

Sannyasin Brahmanathaswami via use-livecode
In reply to this post by Sannyasin Brahmanathaswami via use-livecode
​Hi,



>
> function removeBrackets pString
>   return replacetext(pString,"\[.*\]",empty)
> end removeBrackets
>
>
​​

What would be the result of next  line:?

*put* removeBrackets
​( ​
"1 [A] 2 [B] 3."
​)


Kind regards,

Thierry

------------------------------------------------
Thierry Douez - sunny-tdz.com
sunnYrex - sunnYtext2speech - sunnYperl - sunnYmidi - sunnYmage
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: filter? replace? wildcard? reg exp? help please!

Sannyasin Brahmanathaswami via use-livecode
On 5/12/17 2:08 AM, Thierry Douez via use-livecode wrote:

> ​Hi,
>
>
>
>>
>> function removeBrackets pString
>>   return replacetext(pString,"\[.*\]",empty)
>> end removeBrackets
>>
>>
> ​​
>
> What would be the result of next  line:?
>
> *put* removeBrackets
> ​( ​
> "1 [A] 2 [B] 3."
> ​)

An error. I did warn about my limited regex skills. :) So what should it be?

Also, that's a non-standard format for a function. I've never seen it
written that way before.

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: filter? replace? wildcard? reg exp? help please!

Sannyasin Brahmanathaswami via use-livecode
>
>
>>
>>
>>> function removeBrackets pString
>>>   return replacetext(pString,"\[.*\]",empty)
>>> end removeBrackets
>>>
>> ​​
>>
>> What would be the result of next  line:?
>>
>> *put* removeBrackets
>> ​( ​
>> "1 [A] 2 [B] 3."
>> ​)
>>
>
> An error. I did warn about my limited regex skills. :)

So what should it be?
>
> Also, that's a non-standard format for a function.

I've never seen it written that way before.




This should be a one-line command!
I've typed this post with the new Opera browser....
???


Another try with 2 lines:

put "1 [A] 2 [B] 3." into tText
put  removeBrackets( tText)

​Better?

Thierry​


------------------------------------------------
Thierry Douez - sunny-tdz.com
sunnYrex - sunnYtext2speech - sunnYperl - sunnYmidi - sunnYmage
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: filter? replace? wildcard? reg exp? help please!

Sannyasin Brahmanathaswami via use-livecode
On 5/12/17 3:37 PM, Thierry Douez via use-livecode wrote:

> This should be a one-line command!
> I've typed this post with the new Opera browser....
> ???
>
>
> Another try with 2 lines:
>
> put "1 [A] 2 [B] 3." into tText
> put  removeBrackets( tText)
>
> ​Better?

Yes. It's odd that a browser would reformat it that way.

I see that the middle section is omitted with my regex, so I forgot to
make it non-greedy. But I've forgotten how to do that, something about a
question mark, I think?

--
Jacqueline Landman Gay         |     [hidden email]
HyperActive Software           |     http://www.hyperactivesw.com


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: filter? replace? wildcard? reg exp? help please!

Sannyasin Brahmanathaswami via use-livecode
>
>
>> put "1 [A] 2 [B] 3." into tText
>> put  removeBrackets( tText)
>>
>
> I see that the middle section is omitted with my regex, so I forgot to
> make it non-greedy. But I've forgotten how to do that, something about a
> question mark, I think?


​Sorry about the delay, we had a thunderstorm which broke all Internet
network
in our area since last Friday.

You can do this in 2 ways:

- make your .* non greedy by adding a '?' suffix

- or modify your regex this way:

   "\[ [^\]]*]" which means looking for an open bracket followed by zero to
any number of chars which are not a close bracket, and last a close bracket.
BTW, no need to escape the last closing bracket; the regex engine is smart
enough.


PCRE library accepts the 2 forms.

HTH,

Thierry

--
------------------------------------------------
Thierry Douez - sunny-tdz.com
sunnYrex - sunnYtext2speech - sunnYperl - sunnYmidi - sunnYmage
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

AW: filter? replace? wildcard? reg exp? help please!

Sannyasin Brahmanathaswami via use-livecode
Is there life without internet for one week? - lucky you are connected to the world again!
Tiemo


-----Ursprüngliche Nachricht-----
Von: use-livecode [mailto:[hidden email]] Im Auftrag von Thierry Douez via use-livecode
Gesendet: Freitag, 19. Mai 2017 13:56
An: How to use LiveCode <[hidden email]>
Cc: Thierry Douez <[hidden email]>
Betreff: Re: filter? replace? wildcard? reg exp? help please!

>
>
>> put "1 [A] 2 [B] 3." into tText
>> put  removeBrackets( tText)
>>
>
> I see that the middle section is omitted with my regex, so I forgot to
> make it non-greedy. But I've forgotten how to do that, something about
> a question mark, I think?


​Sorry about the delay, we had a thunderstorm which broke all Internet network in our area since last Friday.

You can do this in 2 ways:

- make your .* non greedy by adding a '?' suffix

- or modify your regex this way:

   "\[ [^\]]*]" which means looking for an open bracket followed by zero to any number of chars which are not a close bracket, and last a close bracket.
BTW, no need to escape the last closing bracket; the regex engine is smart enough.


PCRE library accepts the 2 forms.

HTH,

Thierry

--
------------------------------------------------
Thierry Douez - sunny-tdz.com
sunnYrex - sunnYtext2speech - sunnYperl - sunnYmidi - sunnYmage _______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode


_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode
Reply | Threaded
Open this post in threaded view
|

Re: filter? replace? wildcard? reg exp? help please!

Sannyasin Brahmanathaswami via use-livecode


Is there life without internet for one week?

- lucky you are connected to the world again!
> Tiemo
>

​Hallo Tiemo,

Except some hurdles with the administration ( sold my old car and bought a
new one) plus being insulted by a couple of stressed and egotist people for
not answering sooner,
I did use this time to clean my garden,
did some house construction and enjoyed
to talk longer with friends in the city :)

But I'll have to work all the week-end now :)

Kind regards,

Thierry


> >
> >> put "1 [A] 2 [B] 3." into tText
> >> put  removeBrackets( tText)
> >>
> >
> > I see that the middle section is omitted with my regex, so I forgot to
> > make it non-greedy. But I've forgotten how to do that, something about
> > a question mark, I think?
>
>
> ​Sorry about the delay, we had a thunderstorm which broke all Internet
> network in our area since last Friday.
>
> You can do this in 2 ways:
>
> - make your .* non greedy by adding a '?' suffix
>
> - or modify your regex this way:
>
>    "\[ [^\]]*]" which means looking for an open bracket followed by zero
> to any number of chars which are not a close bracket, and last a close
> bracket.
> BTW, no need to escape the last closing bracket; the regex engine is smart
> enough.
>
>
> PCRE library accepts the 2 forms.
>
> HTH,
>
> Thierry
>  ​
>

--
------------------------------------------------
Thierry Douez - sunny-tdz.com
sunnYrex - sunnYtext2speech - sunnYperl - sunnYmidi - sunnYmage
_______________________________________________
use-livecode mailing list
[hidden email]
Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
http://lists.runrev.com/mailman/listinfo/use-livecode