Workflow and ServiceDesk Community

 View Only

Extract Text By Pattern 

Jun 13, 2012 09:44 AM

Component definition

This component extracts a substring using a regular expression to identify where to start and a length or another regular expression to determine where to end. The start (and end, if used) patterns are NOT included in the output, only the text in between.

Component icon

[Insert component icon Image file here.]

Definition of component input value or values

Evaluation
Input Value Name Input Value Data Type Req'd Example Format Explanation
Text String Yes Script=monitor.sh
RunDate=01/01/2009
Success=1
The text from which to extract a substring. This may be a variable, a constant, a dynamic value or the output of an embedded model.
Start Pattern String Yes RunDate= A regular expression that identifies a tag or string that precedes the data to extract. NOTE: The start pattern itself will NOT be included in the output.
Use Pattern For End Boolean No   If checked, the substring will be all the text between the "Start Pattern" and "End Pattern". If not checked, the substring will be "Result Length" characters starting after the pattern in "Start Pattern".
Result Length Int32 * 10 The number of characters to extract. This is only available/required if "Use Pattern For End" is not checked.
End Pattern String * Success= A regular expression that identifies a tag or string that follows the data to extract. This is only available/required if "Use Pattern For End" is checked. NOTE: The end pattern itself will NOT be included in the output.
Output Variable Name String Yes ScriptRunDate The name of a variable that the extracted string will be stored into.

*When this field is required is described in the "Explanation" column.

Definition of component output value or values

A variable with the name specified in "Output Variable Name" containing the text that was extracted.

Connection information

None

Component settings

None

Use case

Determine if a Script has been Rerun

One way to use this component would be to determine if a script file has been run again since the last time it was checked and to find the oldest run if it was. In this case, there is an xml file that lists the dates and times that a script has been run but not necessarily in date order. In the image below,

  • A maxDate variable is setup (here called Init maxDataDate) from the last date checked.
  • A script run date is then extracted in "Get update date from each" from each line in turn.
  • This component is also (in "Get ID from each") used to extract an ID associated with that run of the script for later use.
  • It is then converted to a date so it can be compared to the previous maximum date found.

[Example 2]

[Describe the use case. Insert screen shots or package files. Insert a description of how the settings are configured. Insert additional information about the use case that you are submitting.]

Statistics
0 Favorited
0 Views
0 Files
0 Shares
0 Downloads

Tags and Keywords

Related Entries and Links

No Related Resource entered.