Home » All About Actions TextSoap

All About Actions


A complete list of the built-in actions available for custom cleaners and what each one does.


Apply Cleaner

Use this action to apply an existing cleaner to the selected text. Custom cleaners can call other cleaners (including other custom cleaners) to do more work. The cleaner specified can be any built-in cleaner or custom cleaner. TextSoap treats both built-in and custom cleaners in the same way.

Note: If the cleaner cannot be found while performing the actions, this action is ignored.




Find & Replace Actions


Find and Replace Text


Use this action to find a text and replace the found text.

Select "Textual" from the pop-up menu to find standard text.


The following meta-characters are supported when using Textual searches:


\\

Backslash (\) character


\r

Traditional carriage return character (this is normally not used within TextSoap as all carriage returns are normalized to \n)


\n

Newline character


\f

Formfeed character


\t

Tab character


\x{HHHH}

Char with unicode hex value: {HHHH}


  

Select "Regular Expression" from the pop-up menu to use the regex syntax. See the regular expression online reference in the Help menu.


Textual options include:


Ignore Case

match text regardless of case

Contains

find any match

Begins with

word specific matches

Whole words

word specific matches

Ends with

word specific matches


Regular expression options include:


Multiline

Control the behavior of ^ and $ in a pattern. By default these will only match at the start and end, respectively, of the input text. If this flag is set, ^ and $ will also match at the start and end of each line within the input text.


Dot Matches All

If set, a . in a pattern will match a line terminator in the input text. By default, it will not. Note that a carriage-return / line-feed pair in text behave as a single line terminator, and will match a single . (period) in a regular expression pattern.


Use Unicode Words

Controls the behavior of \b in a pattern. If set, word boundaries are found according to the definitions of word found in Unicode UAX 29 - Text Boundaries. By default, word boundaries are identified by means of a simple classification of characters as either word or non-word, which approximates traditional regular expression behavior. The results obtained with the two options can be quite different in runs of spaces and other non-word characters.


Allow Comments

allow use of white space and #comments within patterns


Ignore Case

If set, matching will take place in a case-insensitive manner.



Regex Find and Replace Text


"Find and Replace Text" action with the regular expression selected by default.

Bulk Find and Replace Text


Use this action to find and replace a large collection of text items.


Find Text and Associate URL


A variation of the Bulk Find and Replace Text action designed for attaching URLs to specific words or names. For example, you might add "Apple" to the find and use the URL "http://www.apple.com" in the URL column.


When the action finds the word "Apple" in the provide text, it creates a hyperlink for that text using the provided URL.


Find and Replace using Template


This action allows associating up to three values for a given find key. For example, if you were creating an HTML link for a name with a URL and you wanted some of the URLS to open to a new page (but not others), you could add an entry:


Key

Value1

Value2

Value3

Apple

http://www.apple.com

_blank


unmarked software

http://www.unmarked.com




Then use a Replace Template like:


<a href="{value1}" target="{value2}">{key}</a> to create a link that would create an HTML link that would open a new window for the Apple link, but not for unmarked software. unmarked software might be an internal link.


Find Repeating Character


Use this action to search for N or more occurrences of the same character and replace it with a specific value. The search is only for one character, but meta-characters are supported. See "Find and Replace Text" under Textual searches.


For example, specify two or more "\t", the action will match tab tab or tab tab tab and so forth.




Tables In Bulk Actions


Bulk actions that have tables also support copying and pasting to and from the clipboard. Just add a row to the table and then paste in tab-delimited text to fill a table with values. If text columns go beyond the number of columns in the table, they are ignored. To copy the values out, simply select the rows and select Edit > Copy.


Rows may also be re-ordered by dragging and dropping them. Click on the column headers to sort the rows based on the values in the specified column.




General Actions


Title Case with Options

Use this action to provide a customized alternative to the "Capitalize With Title Case" cleaner.

Rewrap Text

Use this action to rewrap the text at the specified number of characters. Text is word wrapped to fit within the specfied character width.


Quote Text

Use this action to quote text. Specify the:

Quote level

Text wrapping

Characters used to quote


Note: The text wrap value is reduced by the number of characters used for quoting.


Insert Text

Use this action to insert a larger amount of text before or after the text.


Tag Text

Use this action to specify text to place before and after selected text. A common use is for applying HTML tags.


Example:

Specify the before tag as "<custom>" and the after tag as "</custom>".

Select a word like "this" and apply the cleaner.

"this" becomes "<custom>this</custom>".


The HTML and PLIST tag cleaners are examples of this type of cleaner action.


Extract Text

Use this action to extract text using a regular expression.


The default behavior replaces the existing text with the extracted text. Select "Append Result" to append the resulting text to the end of the original.


Extract Beginning Characters

Extracts the specified number of characters from the beginning of the text.


Extract Middle Characters

Extracts the specified number of characters from the middle of the text.


Extract End Characters

Extracts the specified number of characters from the end of the text.


Hyperlinks to Text

Converts rich text hyperlinks to text using provided pattern.


Delete Text

Deletes the provides text. Use with a conditional action to remove matched text.



Style Actions


Set Font

Applies font family, face, size attributes to the text.


Set Exact Font

Applies specific font, size attributes to the text.


Adjust Font Size

Relatively adjusts the font size of the text.


Set Underline Attributes

Set the underline style, pattern and color to the text.


Set Strikethrough Attributes

Set the strikethrough style, pattern and color to the text.


Set Super/Subscript Attribute

Set text as being superscript, subscript or having no scripting attribute.


Set Text Color

Set text color.


Set Background Color

Set background color.


Remove a Character Attribute

Remove specific attribute from the text. Attributes include:


Foreground color (text color)

Background color

Underline Style (Any)

Underline Single

Underline Double

Underline Thick

Strikethrough Style (Any)

Strikethrough Single

Strikethrough Double

Strikethrough Thick

Super/Subscript

Superscript

Subscript

Attachment

Link


Attribute will only be removed if it matches as specified. To remove any underline (whether single, double, or thick), use the Underline Style (Any). To only remove a specific single underlines, select "Underline Single" option.




Line Actions


Add Prefix to Lines

Use this action to add a prefix to the beginning of each line.


Remove Prefix from Lines

Use this action to remove a specific prefix (if it exists) from the beginning of each line.


Add Suffix to Lines

Use this action to add a suffix to the end of each line.


Remove Suffix from Lines

Use this action to remove a specific suffix (if it exists) from the end of each line.


Arrange Lines

Use this action to specify which direction you wish to sort the lines.




Conditionals


If Text Matches

Find the provided text and applies related actions to it. 


When using a regular expression, you can also specify which capture group to use. $0 is the default for entire matched string. However, you could specify a find as <tag>(.*?)</tag> and use $1 to only specify the text within the given tag.


If Font Matches

Finds text that matches the font family, size(s), or face attributes (italic or bold). All the attributes can be found independently of each other. For example, you can specify Typeface: Italic to only find italic text, no matter its font family or size.


If Text Has Attribute

Finds text that matches the specified attribute.


End Conditional

Marks the end of a conditional block.



Conditional Blocks


Conditional blocks are a way to apply specific actions only to text that matches a given criteria. The actions inside the block can be virtually anything. Conditionals can even be nested to allow you to match more and more specific criteria. Using nest conditionals, it is possible to find words that are both bold and all uppercase. This example finds all capitalize bold words and changes the text color to red.


Pasted Graphic.tiff





Misc Actions


Run Automator Workflow

This action runs an Automator Workflow (located in the ~/Library/Application Support/TextSoap/Workflows/ folder) on the provided text.


Note: The result of this will be plain text


Call Subroutine

Applies the selected subroutine actions to the text.


See: Apply Cleaner action description



Defined Cleaners


The defined cleaners section contains all of the built-in cleaners plus any existing custom cleaners you've created.


While it is possible to add a recursive call to the cleaner you are editing, it will cause any additional text processing to stop.