Any characters wildcard or regex?

Keith Clarke keith.clarke at me.com
Thu Sep 22 11:45:00 EDT 2016


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 <bonnmike at gmail.com> 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 <keith.clarke at me.com> 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 <klaus at major-k.de> wrote:
>>> 
>>> Hi Mike and Keith,
>>> 
>>>> Am 22.09.2016 um 16:03 schrieb Mike Bonner <bonnmike at gmail.com>:
>>>> 
>>>> 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 <script> and </script>
>>> 
>>> 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 <keith.clarke at me.com>
>> wrote:
>>>> 
>>>>> Hi folks,
>>>>> I’m trying to strip out all HTML tags from text in a variable.
>> Replacement
>>>>> of specific tags works fine... replace “<ul>" 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
>>> klaus at major-k.de
>>> 
>>> 
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at 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 at 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 at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode





More information about the use-livecode mailing list