using the SHELL function to GREP a body of text

jameshale james at thehales.id.au
Fri Mar 18 11:20:28 EDT 2016


I have large bodies of xhtml/html text stored in an array which I would like
to clean up using GREP.
I have been using the 'replacetext' function to great effect but I have hit
an impasse.

There are some situations where I think I really need to use back references
but LC's GREP does not allow them.

for example:


In the example I only want to keep the 'id' attributes but retain the tags
they are in. I have no way of knowing what other attributes are present.

I initially thought I could do this using a non-greedy search pattern which
works in the above case.
eg 


But if the text was...

My non-greedy search pattern would grab  and I would end up with...

losing the id attribute of the header tag.


So I am wondering if it is possible to pass a text variable through the
shell function which would then use a shell script to handle my GREP. 

My app will be deployed on OS X and possible iOS.

At this stage I have not considered the nature of the script I should
construct nor the GREP required to do what I am attempting. (Any hints
gratefully accepted.)

Right now I just want to know if this is a workable approach?

James



--
View this message in context: http://runtime-revolution.278305.n4.nabble.com/using-the-SHELL-function-to-GREP-a-body-of-text-tp4702346.html
Sent from the Revolution - User mailing list archive at Nabble.com.




More information about the Use-livecode mailing list