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.
need help with regex plz
Moderators: DataMystic Support, Moderators, DataMystic Support, Moderators, DataMystic Support, Moderators
- DataMystic Support
- Site Admin
- Posts: 2227
- Joined: Mon Jun 30, 2003 12:32 pm
- Location: Melbourne, Australia
- Contact:
Re: need help with regex plz
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.
\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.
-
- Posts: 22
- Joined: Tue May 12, 2015 3:57 am
Re: need help with regex plz
"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?
Could you explain what this means? Is there any concern to my task?
- DataMystic Support
- Site Admin
- Posts: 2227
- Joined: Mon Jun 30, 2003 12:32 pm
- Location: Melbourne, Australia
- Contact:
Re: need help with regex plz
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?
The processLine function should just pass any text through unchanged.
Does that make sense?