*! version 1.1 10 May 2017
help for stringcomplianceversion 1.1 (10 May 2017)

Title

stringcompliance -- Check a list of given strings to match a given list of regular expressions

Table of contents

Syntax
Description
Options
Remarks
Examples
Author
Saved results
Also see

Syntax

stringcompliance list of strings , ruleset(rules) [ verbose ]

Description

stringcompliances is designed as a programmer's command to judge if a each entry in a given list of strings
(for instance: a list of variable names) matches one or more regular expression "rules".

Each string in the specified list will be tested for matching the regular expressions specified.

If so, it will be returned as a result value in r(), and an appropriate message will be printed to the output (if the option verbose has been specified).

Options

Main

ruleset(rules) is mandatory. One or more regular expressions can be specified as rules to test the compliance of the given strings.

If more than one regular expression rule is specified, each rule must be enclosed in double quotes.

Advanced

verbose drops verbose output during the process. Possibly needed for debugging your syntax.

Remarks

This command is part of the NEPmgmt bundle, written to help creating the NEPS dataset files.

The source code of the program is licensed under the GNU General Public License version 3 or later.
The corresponding license text can be found on the internet at http://www.gnu.org/licenses/ or in gnugpl.

Examples

Check if each string in the list begins wit hthe letter m:

. stringcompliance mpg rep78 rep77 , rules("^m")

Check if each string in the list ends in numbers:

. stringcompliance mpg rep78 rep77 , rules("[0-9]$")

Check if each string in the list begins with the letter m or ends in numbers:

. stringcompliance mpg rep78 rep77 , rules("^m" "[0-9]$")

Author

Daniel Bela (daniel.bela@lifbi.de),
Leibniz Institute for Educational Trajectories (LIfBi), Germany.

Saved results

stringcompliance saves the following in r():

Scalars

r(rulecount) number of specified rules, as of option ruleset(rules)

r(unmatchedcount) number of string elements that could not be matched to any rule

r(rule1matchcount) number of string elements that matched to rule number 1

r(rule2matchcount) number of string elements that matched to rule number 2

... ...

r(ruleNmatchcount) number of string elements that matched to rule number N

Macros

r(unmatched) list of string elements that could not be matched to any rule (if any)

r(rule1expression) regular expression used for rule 1 (if any)

r(rule2expression) regular expression used for rule 2 (if any)

... ...

r(ruleNexpression) regular expression used for rule N (if any)

r(rule1matches) list of string elements that matched to rule number 1 (if any)

r(rule2matches) list of string elements that matched to rule number 2 (if any)

... ...

r(ruleNmatches) list of string elements that matched to rule number N (if any)

Also see

NEPSmgmt (if installed), regular expressions