Re: Any characters wildcard or regex?

2016-09-22 Thread Dave Cragg

> On 22 Sep 2016, at 16:45, Keith Clarke  wrote:
> 
> Thanks Mike, pilot error here - replacetext(tData,"<.*>",empty) looks to be a 
> viable direction of travel once correctly typed. Time to rest my eyes, 
> methinks! 8-)
> Best,
> Keith..

I think you might need replacetext(tData,"<.*?>",empty)

The '?' cause the match to be non-greedy. Without it, everything from the first 
"<" to the last ">" will be replaced.

Cheers
Dave
___
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: Any characters wildcard or regex?

2016-09-22 Thread Keith Clarke
Thanks Mike, pilot error here - replacetext(tData,"<.*>",empty) looks to be a 
viable direction of travel once correctly typed. Time to rest my eyes, 
methinks! 8-)
Best,
Keith..
  
> On 22 Sep 2016, at 16:23, Mike Bonner  wrote:
> 
> if you want to use regex, I think you have to use replacetext rather than
> replace, unless replace has been updated when I wasn't looking.
> I did a quicky test..
> 
> put field 1 into tData -- field with text containing html tags
> put replacetext(tData,"<.*>",empty) into tNewData
> put tNewData
> 
> Also, in your example above I assume you correctly set the htmltext rather
> than the html..
> 
> On Thu, Sep 22, 2016 at 8:46 AM, Keith Clarke  wrote:
> 
>> Thanks Mike & Klaus,
>> The simple line 'replace "<.*>" with empty in tFileText’ would be ideal,
>> but it seems to be ignored.
>> 
>> The html approach seems to hit an early hurdle, too - if I...
>> 
>> set the html of field "FldFileText" to URL(tFileName)
>> set the text of field "FldFileText" to the text of field “FldFileText
>> 
>> ...this results in an empty field after the first or both lines. Perhaps
>> this is because the source file is a CSV with only one item having any HTML
>> tags?
>> 
>> Just to clarify the problem - the source text I’m working with comes from
>> CSV file imports and some files contain RTF fields amongst their items.
>> These RTF styling tags sometimes contain quotes & commas that are causing
>> occasional glitches with the CSV item delimiting - hence the need to
>> pre-process and strip out all tags before processing the CSV import.
>> 
>> Thanks again for your insights.
>> Best,
>> Keith..
>> 
>>> On 22 Sep 2016, at 15:12, Klaus major-k  wrote:
>>> 
>>> Hi Mike and Keith,
>>> 
 Am 22.09.2016 um 16:03 schrieb Mike Bonner :
 
 Using replacetext, you're probably looking for "<.*>"
 but you might be able to use a field for this..  set the htmltext of the
 field to your source text, Then if you don't want the formatting
>> preserved
 set the text of the field to the text of the field.  One problem with
>> this
 method is that you may end up with javascript left over because it can
 appear between  and 
>>> 
>>> you can even (ab)use "the templatefield" for this:
>>> ...
>>> set the htmltext of the templatefield to url("http://your_url/here.html
>> ")
>>> put the text of the templatefield into fld 1 # or a variable
>>> reset the templatefield ## !!
>>> ...
>>> 
 On Thu, Sep 22, 2016 at 7:34 AM, Keith Clarke 
>> wrote:
 
> Hi folks,
> I’m trying to strip out all HTML tags from text in a variable.
>> Replacement
> of specific tags works fine... replace “" with empty in tText …but
>> I’m
> struggling to find (documentation on) a blanket ‘any number of any
> characters’ wildcard or regex approach...
> 
> So far I’ve tried "<*>”, “<[*]>”,  “<[.*]>”, "<" & "[.*]" & “>” to no
>> avail
> 
> Any clues greatly appreciated.
> Best,
> Keith..
>>> 
>>> Best
>>> 
>>> Klaus
>>> 
>>> --
>>> Klaus Major
>>> http://www.major-k.de
>>> kl...@major-k.de
>>> 
>>> 
>>> ___
>>> 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
> ___
> 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: Any characters wildcard or regex?

2016-09-22 Thread Mike Bonner
if you want to use regex, I think you have to use replacetext rather than
replace, unless replace has been updated when I wasn't looking.
I did a quicky test..

put field 1 into tData -- field with text containing html tags
put replacetext(tData,"<.*>",empty) into tNewData
put tNewData

Also, in your example above I assume you correctly set the htmltext rather
than the html..

On Thu, Sep 22, 2016 at 8:46 AM, Keith Clarke  wrote:

> Thanks Mike & Klaus,
> The simple line 'replace "<.*>" with empty in tFileText’ would be ideal,
> but it seems to be ignored.
>
> The html approach seems to hit an early hurdle, too - if I...
>
> set the html of field "FldFileText" to URL(tFileName)
> set the text of field "FldFileText" to the text of field “FldFileText
>
> ...this results in an empty field after the first or both lines. Perhaps
> this is because the source file is a CSV with only one item having any HTML
> tags?
>
> Just to clarify the problem - the source text I’m working with comes from
> CSV file imports and some files contain RTF fields amongst their items.
> These RTF styling tags sometimes contain quotes & commas that are causing
> occasional glitches with the CSV item delimiting - hence the need to
> pre-process and strip out all tags before processing the CSV import.
>
> Thanks again for your insights.
> Best,
> Keith..
>
> > On 22 Sep 2016, at 15:12, Klaus major-k  wrote:
> >
> > Hi Mike and Keith,
> >
> >> Am 22.09.2016 um 16:03 schrieb Mike Bonner :
> >>
> >> Using replacetext, you're probably looking for "<.*>"
> >> but you might be able to use a field for this..  set the htmltext of the
> >> field to your source text, Then if you don't want the formatting
> preserved
> >> set the text of the field to the text of the field.  One problem with
> this
> >> method is that you may end up with javascript left over because it can
> >> appear between  and 
> >
> > you can even (ab)use "the templatefield" for this:
> > ...
> > set the htmltext of the templatefield to url("http://your_url/here.html
> ")
> > put the text of the templatefield into fld 1 # or a variable
> > reset the templatefield ## !!
> > ...
> >
> >> On Thu, Sep 22, 2016 at 7:34 AM, Keith Clarke 
> wrote:
> >>
> >>> Hi folks,
> >>> I’m trying to strip out all HTML tags from text in a variable.
> Replacement
> >>> of specific tags works fine... replace “" with empty in tText …but
> I’m
> >>> struggling to find (documentation on) a blanket ‘any number of any
> >>> characters’ wildcard or regex approach...
> >>>
> >>> So far I’ve tried "<*>”, “<[*]>”,  “<[.*]>”, "<" & "[.*]" & “>” to no
> avail
> >>>
> >>> Any clues greatly appreciated.
> >>> Best,
> >>> Keith..
> >
> > Best
> >
> > Klaus
> >
> > --
> > Klaus Major
> > http://www.major-k.de
> > kl...@major-k.de
> >
> >
> > ___
> > 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
___
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: Any characters wildcard or regex?

2016-09-22 Thread Keith Clarke
Thanks Mike & Klaus,
The simple line 'replace "<.*>" with empty in tFileText’ would be ideal, but it 
seems to be ignored.

The html approach seems to hit an early hurdle, too - if I...

set the html of field "FldFileText" to URL(tFileName)
set the text of field "FldFileText" to the text of field “FldFileText

...this results in an empty field after the first or both lines. Perhaps this 
is because the source file is a CSV with only one item having any HTML tags?

Just to clarify the problem - the source text I’m working with comes from CSV 
file imports and some files contain RTF fields amongst their items. These RTF 
styling tags sometimes contain quotes & commas that are causing occasional 
glitches with the CSV item delimiting - hence the need to pre-process and strip 
out all tags before processing the CSV import. 

Thanks again for your insights.
Best,
Keith..

> On 22 Sep 2016, at 15:12, Klaus major-k  wrote:
> 
> Hi Mike and Keith,
> 
>> Am 22.09.2016 um 16:03 schrieb Mike Bonner :
>> 
>> Using replacetext, you're probably looking for "<.*>"
>> but you might be able to use a field for this..  set the htmltext of the
>> field to your source text, Then if you don't want the formatting preserved
>> set the text of the field to the text of the field.  One problem with this
>> method is that you may end up with javascript left over because it can
>> appear between  and 
> 
> you can even (ab)use "the templatefield" for this:
> ...
> set the htmltext of the templatefield to url("http://your_url/here.html;)
> put the text of the templatefield into fld 1 # or a variable
> reset the templatefield ## !!
> ...
> 
>> On Thu, Sep 22, 2016 at 7:34 AM, Keith Clarke  wrote:
>> 
>>> Hi folks,
>>> I’m trying to strip out all HTML tags from text in a variable. Replacement
>>> of specific tags works fine... replace “" with empty in tText …but I’m
>>> struggling to find (documentation on) a blanket ‘any number of any
>>> characters’ wildcard or regex approach...
>>> 
>>> So far I’ve tried "<*>”, “<[*]>”,  “<[.*]>”, "<" & "[.*]" & “>” to no avail
>>> 
>>> Any clues greatly appreciated.
>>> Best,
>>> Keith..
> 
> Best
> 
> Klaus
> 
> --
> Klaus Major
> http://www.major-k.de
> kl...@major-k.de
> 
> 
> ___
> 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: Any characters wildcard or regex?

2016-09-22 Thread Klaus major-k
Hi Mike and Keith,

> Am 22.09.2016 um 16:03 schrieb Mike Bonner :
> 
> Using replacetext, you're probably looking for "<.*>"
> but you might be able to use a field for this..  set the htmltext of the
> field to your source text, Then if you don't want the formatting preserved
> set the text of the field to the text of the field.  One problem with this
> method is that you may end up with javascript left over because it can
> appear between  and 

you can even (ab)use "the templatefield" for this:
...
set the htmltext of the templatefield to url("http://your_url/here.html;)
put the text of the templatefield into fld 1 # or a variable
reset the templatefield ## !!
...

> On Thu, Sep 22, 2016 at 7:34 AM, Keith Clarke  wrote:
> 
>> Hi folks,
>> I’m trying to strip out all HTML tags from text in a variable. Replacement
>> of specific tags works fine... replace “" with empty in tText …but I’m
>> struggling to find (documentation on) a blanket ‘any number of any
>> characters’ wildcard or regex approach...
>> 
>> So far I’ve tried "<*>”, “<[*]>”,  “<[.*]>”, "<" & "[.*]" & “>” to no avail
>> 
>> Any clues greatly appreciated.
>> Best,
>> Keith..

Best

Klaus

--
Klaus Major
http://www.major-k.de
kl...@major-k.de


___
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: Any characters wildcard or regex?

2016-09-22 Thread Mike Bonner
Using replacetext, you're probably looking for "<.*>"
but you might be able to use a field for this..  set the htmltext of the
field to your source text, Then if you don't want the formatting preserved
set the text of the field to the text of the field.  One problem with this
method is that you may end up with javascript left over because it can
appear between  and 

On Thu, Sep 22, 2016 at 7:34 AM, Keith Clarke  wrote:

> Hi folks,
> I’m trying to strip out all HTML tags from text in a variable. Replacement
> of specific tags works fine... replace “" with empty in tText …but I’m
> struggling to find (documentation on) a blanket ‘any number of any
> characters’ wildcard or regex approach...
>
> So far I’ve tried "<*>”, “<[*]>”,  “<[.*]>”, "<" & "[.*]" & “>” to no avail
>
> Any clues greatly appreciated.
> Best,
> Keith..
> ___
> 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