String utility operations.
- Copyright:
-
- Crown Copyright 2016
- License:
-
- Apache-2.0
- Source:
Members
-
<static, constant> REGEX_PRE_POPULATE
-
- Default Value:
-
- ["{\"name\":\"User defined\",\"value\":\"\"}","{\"name\":\"IPv4 address\",\"value\":\"(?:(?:\\\\d|[01]?\\\\d\\\\d|2[0-4]\\\\d|25[0-5])\\\\.){3}(?:25[0-5]|2[0-4]\\\\d|[01]?\\\\d\\\\d|\\\\d)(?:\\\\/\\\\d{1,2})?\"}","{\"name\":\"IPv6 address\",\"value\":\"((?=.*::)(?!.*::.+::)(::)?([\\\\dA-Fa-f]{1,4}:(:|\\\\b)|){5}|([\\\\dA-Fa-f]{1,4}:){6})((([\\\\dA-Fa-f]{1,4}((?!\\\\3)::|:\\\\b|(?![\\\\dA-Fa-f])))|(?!\\\\2\\\\3)){2}|(((2[0-4]|1\\\\d|[1-9])?\\\\d|25[0-5])\\\\.?\\\\b){4})\"}","{\"name\":\"Email address\",\"value\":\"(\\\\w[-.\\\\w]*)@([-\\\\w]+(?:\\\\.[-\\\\w]+)*)\\\\.([A-Za-z]{2,4})\"}","{\"name\":\"URL\",\"value\":\"([A-Za-z]+://)([-\\\\w]+(?:\\\\.\\\\w[-\\\\w]*)+)(:\\\\d+)?(/[^.!,?;\\\"\\\\x27<>()\\\\[\\\\]{}\\\\s\\\\x7F-\\\\xFF]*(?:[.!,?]+[^.!,?;\\\"\\\\x27<>()\\\\[\\\\]{}\\\\s\\\\x7F-\\\\xFF]+)*)?\"}","{\"name\":\"Domain\",\"value\":\"(?:(https?):\\\\/\\\\/)?([-\\\\w.]+)\\\\.(com|net|org|biz|info|co|uk|onion|int|mobi|name|edu|gov|mil|eu|ac|ae|af|de|ca|ch|cn|cy|es|gb|hk|il|in|io|tv|me|nl|no|nz|ro|ru|tr|us|az|ir|kz|uz|pk)+\"}","{\"name\":\"Windows file path\",\"value\":\"([A-Za-z]):\\\\\\\\((?:[A-Za-z\\\\d][A-Za-z\\\\d\\\\- \\\\x27_\\\\(\\\\)]{0,61}\\\\\\\\?)*[A-Za-z\\\\d][A-Za-z\\\\d\\\\- \\\\x27_\\\\(\\\\)]{0,61})(\\\\.[A-Za-z\\\\d]{1,6})?\"}","{\"name\":\"UNIX file path\",\"value\":\"(?:/[A-Za-z\\\\d.][A-Za-z\\\\d\\\\-.]{0,61})+\"}","{\"name\":\"MAC address\",\"value\":\"[A-Fa-f\\\\d]{2}(?:[:-][A-Fa-f\\\\d]{2}){5}\"}","{\"name\":\"Date (yyyy-mm-dd)\",\"value\":\"((?:19|20)\\\\d\\\\d)[- /.](0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])\"}","{\"name\":\"Date (dd/mm/yyyy)\",\"value\":\"(0[1-9]|[12][0-9]|3[01])[- /.](0[1-9]|1[012])[- /.]((?:19|20)\\\\d\\\\d)\"}","{\"name\":\"Date (mm/dd/yyyy)\",\"value\":\"(0[1-9]|1[012])[- /.](0[1-9]|[12][0-9]|3[01])[- /.]((?:19|20)\\\\d\\\\d)\"}","{\"name\":\"Strings\",\"value\":\"[A-Za-z\\\\d/\\\\-:.,_$%\\\\x27\\\"()<>= !\\\\[\\\\]{}@]{4,}\"}"]
- Source:
-
<static, constant> REGEX_CASE_INSENSITIVE
-
- Default Value:
-
- true
- Source:
-
<static, constant> REGEX_MULTILINE_MATCHING
-
- Default Value:
-
- true
- Source:
-
<static, constant> OUTPUT_FORMAT
-
- Default Value:
-
- ["Highlight matches","List matches","List capture groups","List matches with capture groups"]
- Source:
-
<static, constant> DISPLAY_TOTAL
-
- Source:
-
<static, constant> CASE_SCOPE
-
- Default Value:
-
- ["All","Word","Sentence","Paragraph"]
- Source:
-
<static, constant> SEARCH_TYPE
-
- Default Value:
-
- ["Regex","Extended (\\n, \\t, \\x...)","Simple string"]
- Source:
-
<static, constant> FIND_REPLACE_GLOBAL
-
- Default Value:
-
- true
- Source:
-
<static, constant> FIND_REPLACE_CASE
-
- Source:
-
<static, constant> FIND_REPLACE_MULTILINE
-
- Default Value:
-
- true
- Source:
-
<static, constant> SPLIT_DELIM
-
- Default Value:
-
- ,
- Source:
-
<static, constant> DELIMITER_OPTIONS
-
- Default Value:
-
- ["Line feed","CRLF","Space","Comma","Semi-colon","Colon","Nothing (separate chars)"]
- Source:
-
<static, constant> DIFF_SAMPLE_DELIMITER
-
- Default Value:
-
- \n\n
- Source:
-
<static, constant> DIFF_BY
-
- Default Value:
-
- ["Character","Word","Line","Sentence","CSS","JSON"]
- Source:
-
<static, constant> OFF_CHK_SAMPLE_DELIMITER
-
- Default Value:
-
- \n\n
- Source:
Methods
-
<static> run_regex(input, args)
-
Regular expression operation.
Parameters:
Name Type Description input
string args
Array.<Object> - Source:
Returns:
- Type
- html
-
<static> run_upper(input, args)
-
To Upper case operation.
Parameters:
Name Type Description input
string args
Array.<Object> - Source:
Returns:
- Type
- string
-
<static> run_lower(input, args)
-
To Upper case operation.
Parameters:
Name Type Description input
string args
Array.<Object> - Source:
Returns:
- Type
- string
-
<static> run_find_replace(input, args)
-
Find / Replace operation.
Parameters:
Name Type Description input
string args
Array.<Object> - Source:
Returns:
- Type
- string
-
<static> run_split(input, args)
-
Split operation.
Parameters:
Name Type Description input
string args
Array.<Object> - Source:
Returns:
- Type
- string
-
<static> run_diff(input, args)
-
Diff operation.
Parameters:
Name Type Description input
string args
Array.<Object> - Source:
Returns:
- Type
- html
-
<static> run_offset_checker(input, args)
-
Offset checker operation.
Parameters:
Name Type Description input
string args
Array.<Object> - Source:
Returns:
- Type
- html
-
<static> run_parse_escaped_string(input, args)
-
Parse escaped string operation.
Parameters:
Name Type Description input
string args
Array.<Object> - Source:
Returns:
- Type
- string
-
<private, static> _regex_highlight(input, regex, display_total)
-
Adds HTML highlights to matches within a string.
Parameters:
Name Type Description input
string regex
RegExp display_total
boolean - Source:
Returns:
- Type
- string
-
<private, static> _regex_list(input, regex, display_total, matches, capture_groups)
-
Creates a string listing the matches within a string.
Parameters:
Name Type Description input
string regex
RegExp display_total
boolean matches
boolean Display full match
capture_groups
boolean Display each of the capture groups separately
- Source:
Returns:
- Type
- string