need help with regex plz

Get help with installation and running here.

Moderators: DataMystic Support, Moderators

nikolas1612
Posts: 22
Joined: Tue May 12, 2015 3:57 am

need help with regex plz

Postby nikolas1612 » Tue May 12, 2015 4:12 am

Trying to decide the following problem by regex in Textpipe:

Mark (no matter how) every FIRST unique abbreviation in text (for instance consisting of 3 capital letters \b[A-Z]{3}\b). The latter abbreviations coinciding with the marked ones are to be ignored. Got no idea how to do that.
Thanks for any help on the subject.

User avatar
DataMystic Support
Site Admin
Posts: 2138
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: need help with regex plz

Postby DataMystic Support » Wed May 13, 2015 5:03 pm

Use
\b[A-Z]{3}\b
as your search text, and
$0
as the replace text.

Then add a scripting filter as a subfilter. Inside the script filter, record each arriving fragment in an array - if it is already there, don't mark it. If it is there already, mark it.

We can provide consulting help if needed here.
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments

nikolas1612
Posts: 22
Joined: Tue May 12, 2015 3:57 am

Re: need help with regex plz

Postby nikolas1612 » Wed May 20, 2015 4:46 pm

"Note: startFile() is ALSO called when the Script is a sub filter, for each text value that the sub filter operates on. The impact of this is that real per-file initialization/finalization needs to be performed in a script that is not inside any sub filters".

Could you explain what this means? Is there any concern to my task?

User avatar
DataMystic Support
Site Admin
Posts: 2138
Joined: Mon Jun 30, 2003 12:32 pm
Location: Melbourne, Australia
Contact:

Re: need help with regex plz

Postby DataMystic Support » Thu May 21, 2015 8:43 am

Easy - just add a second script filter outside of any subfilter, that is there purely for the startFile and endFile functions.

The processLine function should just pass any text through unchanged.

Does that make sense?
Regards,

Simon Carter, http://DataMystic.com/forums/index.php
http://PredictBGL.com - Insulin dose calculator for Type 1 diabetes
http://DownloadPipe.com - 250,000 free software downloads
http://DetachPipe.com - send huge email attachments


Return to “TextPipe Tips and Tricks, Questions and Support”

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest