Contents 

Overview
Fundamentals
Variable declaration
Variable assignment
Adding variables
Setting variables
Include function
Evaluate function
Constants
Arrays
If...then...else Statement
For Statement
Foreach Statement
While Statement
Function definition
Operators
Comments
Performance Profiler
Functions
String processing
Overview
Length
Left
Right
Mid
Trim
TrimLeft
TrimRight
ToUpper
ToLower
Find
FindOneOf
ReverseFind
WildcardCompare
Tokenize
RegularExpressionMatch
RegularExpressionParse
Operator [ ]
Delete
Remove
Replace
MakeReverse
SpanIncluding
SpanExcluding
ToUTF8
FromUTF8
File IO routines
Overview
ReadData
ReadDataToString
WriteData
ReadString
WriteString
AppendString
GetLastFileError
EOF
CloseFile
CreateDir
RemoveDir
ChangeDir
GetCurrentDir
IsFileExist
FileSize
CopyFile
MoveFile
RemoveFile
Seek
SeekToBegin
SeekToEnd
SetFileEncoding
SetUseUnicodeBOM
ListFiles
CountFilesInFolder
MapNetworkDrive
DisconnectNetworkDrive
EnumerateDrives
GetDriveInfo
Time routines
Overview
Sleep
MilliSleep
GetTime
GetTimeString
FormatTime
ConvertToUnixTime
GetTickCount
SNMP management
Overview
SnmpGet
SnmpGetNext
SnmpGetBulk
SnmpSet
GetPduErrorStatus
GetPduErrorString
GetPduErrorIndex
GetVarCount
GetVarAt
CreatePdu
AppendVar
GetVarOID
GetVarResolvedName
GetVarValue
GetVarResolvedValue
GetVarResolvedDescription
GetVarSyntax
CreateVar
GetPduIp
GetPduEnterprise
GetPduTrapCode
GetPduTrapName
GetPduResolvedTrapName
GetPduResolvedTrapDescription
GetPduCommunity
GetPduVersion
SendTrap
ForwardTrap
PrepareTrapPdu
SetMaxPduSize
SNMP MIB functions
Overview
LoadMIB
ResolveOID
GetOidByName
ResolveTrap
UnloadMIB
QuickMibLookup
Cryptography
Overview
Encrypt
Decrypt
CalculateMD5Hash
CalculateSHA1Hash
HMAC
BuildKeyFromPassword
Base64Encode
Base64Decode
CRC16
CRC32
HexStringToByteArray
ByteArrayToHexString
Skype integration functions
Overview
SkypeGetContacts
SkypeSendChatMessage
SkypeSendSMS
SkypeCallAndSpeakText
XML processing
Overview
ReadXml
WriteXml
GetXmlTag
CreateXml
InsertAttr
IsXmlValid
SelectXmlNodes
XslTransform
GetAttrString
GetAttrInt
GetAttrDouble
GetXmlBody
GetXmlAttributes
SetXmlBody
AddChild
GetChildrenCount
GetChildAt
JSON processing
Overview
ParseJSON
ToJSON
FTP functions
Overview
FtpOpen
FtpClose
FtpGetCurrentDir
FtpSetCurrentDir
FtpCreateDir
FtpRemoveDir
FtpGet
FtpPut
FtpRemoveFile
FtpRenameFile
FtpListFiles
FtpCountFilesInFolder
TFTP functions
Overview
TFTPGet
TFTPPut
Networking functions
Overview
HttpPing
HttpGet
HttpPost
OpenTCPConnection
OpenUDPSocket
SendTCPData
SendUDPData
IsDataAvailable
ReadTCPData
ReadUDPData
CloseSocket
TCPListen
TCPAcceptConnection
GetHostByAddress
GetAddressByName
DnsQuery
SendMail
SendMailEx
SendHtmlMail
TestSMTPConnection
GetHostName
GetHostDnsSuffix
GetSocketName
SetSocketOption
TestPOP3Connection
POP3GetStats
POP3 Mail Client Example
Ping
TraceRoute
GetMacAddress
EnumerateSharedResources
Working with serial ports and USB HID devices
Overview
OpenSerialPort
CloseSerialPort
IsSerialDataAvailable
ReadSerialData
WriteSerialData
WriteSerialControlChar
SetSerialFlowControl
ClearSerialDTR
ClearSerialRTS
SetSerialDTR
SetSerialRTS
SetSerialXOFF
SetSerialXON
SetSerialBreak
ClearSerialBreak
GetSerialModemStatus
USBOpen
USBClose
USBWriteFeatureReport
USBReadFeatureReport
USBWriteData
USBReadData
USBEnumerateDevices
USBGetFeatureReportLength
Working with Ginkgo USB-I2C adapter
Overview
USBAdapterOpen
USBAdapterClose
USBAdapterBoardInfo
USBAdapterSetPins
USBAdapterResetPins
USBAdapterSetInput
USBAdapterSetOutput
USBAdapterSetOpenDrain
USBAdapterReadGPIO
USBAdapterGetErrorString
USBAdapterSetReadBufferSize
USBAdapterInitI2C
USBAdapterInitTimeConfig
USBAdapterInitADC
USBAdapterInitPWM
USBAdapterInitCNT
USBAdapterInitUART
USBAdapterReadI2C
USBAdapterReadSlaveI2C
USBAdapterReadADC
USBAdapterReadUART
USBAdapterWriteI2C
USBAdapterWriteSlaveI2C
USBAdapterWriteUART
USBAdapterSetPWMPulse
USBAdapterSetPWMPeriod
USBAdapterStartPWM
USBAdapterStopPWM
USBAdapterSetCounter
USBAdapterStartCounter
USBAdapterGetCounter
USBAdapterStopCounter
Working with GSM modems
Overview
SendSMS
RetrieveAllSMSMessages
RetrieveUnreadSMSMessages
DeleteSMSMessage
DeleteAllSMSMessages
Working with zip archives
Overview
ZipFiles
UnzipFiles
AddFileToZip
AddFolderToZip
RemoveFileFromZip
ListFilesInZip
UnzipFile
Mathematical routines
Overview
abs
acos
asin
atan
CalculateScaleFactor
cos
cosh
exp
IsNAN
log
log10
max
mod
pow
ScaleArray
sin
sinh
sqrt
tan
tanh
Charts
Overview
CreateGauge
CreatePieChart
CreateBarChart
CreateLineChart
CreateXYLineChart
Database Interface
Overview
DBOpen
DBClose
DBExecuteSQL
DBSelect
DBInsertSelect
DBGetSQLStatus
DBGetSQLErrorString
CompactAccessDB
GetDataSources
CreateDataSource
RemoveDataSource
DBSetLoginTimeout
DBSetQueryTimeout
Using in-memory cache
Overview
AddCacheEntry
RemoveCacheEntry
RemoveAllCacheEntries
GetCacheEntriesCount
CacheLookup
FindEntryInCache
CacheLoad
CacheSave
CacheToString
Round Robin Databases
Overview
RrdCreate
RrdUpdate
RrdRemove
RrdFetch
RrdGetCurrentValue
Event Log functions
Overview
EventLogGetNumberOfRecords
EventLogGetOldestRecord
EventLogReadRecord
EventLogWaitForEvent
EventLogWriteRecord
Service Control Manager
Overview
SCMEnumerateServices
SCMGetServiceInfo
SCMStartService
SCMStopService
Parameter Files
Overview
GetParameterCount
GetParameterName
GetParameterType
GetParameterValue
GetParameterDisplayName
GetParameterDescription
GetParameterEnumValues
GetParameterEnumValue
GetEnumValueNameFromInt
Process management functions
Overview
ExecuteCommand
RunCommand
FindProcess
GetProcesses
RedirectOpen
RedirectClose
RedirectGetStdOut
RedirectGetStdError
RedirectSendInput
GetProcessorUsage
GetMemoryUsage
WMI functions
Overview
WMIOpen
WMIClose
WMIQuery
WMIGetErrorStatus
Short Message Peer-to-Peer (SMPP)
Overview
SmppOpen
SmppClose
SmppSubmitMessage
SmppEnquireLink
SmppGetLastError
Query functions
Overview
LDAPQuery
REGQuery
CSVQuery
TSVQuery
EventLogQuery
TextLineQuery
TextWordQuery
FSQuery
GetQueryStatus
GetQueryErrorString
Microsoft Outlook integration
Overview
OpenOutlookSession
CloseOutlookSession
OutlookSendMail
OutlookSendMeetingRequest
OutlookCreateTask
Ports IO
Overview
ReadPort
WritePort
IBM WebSphere Message Queue (MQ) functions
Overview
WMQConnect
WMQDisconnect
WMQOpenQueue
WMQCloseQueue
WMQPutMessage
WMQGetMessages
WMQGetManagerStatus
WMQGetQueueStatus
WMQSetOptions
Other routines
Overview
Println
MessageBox
ToString
ToInteger
ToDouble
ToChar
ToByte
ToXml
LogMessage
GetLastSystemError
GetSystemErrorString
GetEnvironmentStrings
GetEnv
SetEnv
IsVariableExist
IsArrayElementExist
GetArraySize
GetArrayIndex
PreallocateArrayHashTable
Sort
IsBitSet
SetBit
ClearBit
ToggleBit
Beep
GetNetDecisionSystemDir
PlaySound
TextToSpeech
Rand
SeedRand
GenerateUID
RGB
Logon
Reboot

NetDecision Script Language Reference

Prev Page Next Page

RegularExpressionMatch

int RegularExpressionMatch ( string regexp, string string )

Return Value

Returns TRUE if string matches pattern. Otherwise returns FALSE.

Parameters

regexppattern string containing regular espression.

string – string that needs to be compared with regexp.

Remarks

Regular expressions ("regex's" for short) are sets of symbols and syntactic elements used to match patterns of text.Regular expressions can be used to test for certain conditions in an input string.

Regular Expression Syntax
This table lists the metacharacters understood by
RegularExpressionMatchfunction:

Metacharacter Meaning
. Matches any single character.
[ ] Indicates a character class. Matches any character inside the brackets (for example, [abc] matches "a", "b", and "c").
^ If this metacharacter occurs at the start of a character class, it negates the character class. A negated character class matches any character except those inside the brackets (for example, [^abc] matches all characters except "a", "b", and "c").

If ^ is at the beginning of the regular expression, it matches the beginning of the input (for example, ^[abc] will only match input that begins with "a", "b", or "c").

- In a character class, indicates a range of characters (for example, [0-9] matches any of the digits "0" through "9").
? Indicates that the preceding expression is optional: it matches once or not at all (for example, [0-9][0-9]? matches "2" and "12").
+ Indicates that the preceding expression matches one or more times (for example, [0-9]+ matches "1", "13", "666", and so on).
* Indicates that the preceding expression matches zero or more times.
??, +?, *? Non-greedy versions of ?, +, and *. These match as little as possible, unlike the greedy versions which match as much as possible. Example: given the input "<abc><def>", <.*?> matches "<abc>" while <.*> matches "<abc><def>".
( ) Grouping operator. Example: (\d+,)*\d+ matches a list of numbers separated by commas (such as "1" or "1,23,456").
{ } Indicates a match group. Match groups are indicated by braces, and allow you to extract the actual text that matches the regular expression using RegularExpressionParse function.
\ Escape character: interpret the next character literally (for example, [0-9]+ matches one or more digits, but [0-9]\+ matches a digit followed by a plus character). Also used for abbreviations (such as \a for any alphanumeric character; see table below).

If \ is followed by a number n, it matches the nth match group (starting from 0). Example: <{.*?}>.*?</\0> matches "<head>Contents</head>".

Note that in NetDecision script language strings, two backslashes must be used: "\\+", "\\a", "<{.*?}>.*?</\\0>".

$ At the end of a regular expression, this character matches the end of the input. Example: [0-9]$ matches a digit at the end of the input.
| Alternation operator: separates two expressions, exactly one of which matches (for example, T|the matches "The" or "the").
! Negation operator: the expression following ! does not match the input. Example: a!b matches "a" not followed by "b".

Abbreviations

RegularExpressionMatch can handle abbreviations, such as \d instead of [0-9]. The following abbreviations are defined:

Abbreviation Matches
\a Any alphanumeric character: ([a-zA-Z0-9])
\b White space (blank): ([ \\t])
\c Any alphabetic character: ([a-zA-Z])
\d Any decimal digit: ([0-9])
\h Any hexadecimal digit: ([0-9a-fA-F])
\n Newline: (\r|(\r?\n))
\q A quoted string: (\"[^\"]*\")|(\'[^\']*\')
\w A simple word: ([a-zA-Z]+)
\z An integer: ([0-9]+)

Example

The following example demonstrates the use of RegularExpressionMatch.

# Example for RegularExpressionMatch
# match any line that starts with any number of digits,
# has a colon, and ends with any number of digits
 
if (RegularExpressionMatch("{[0-9]?[0-9]}:{[0-9][0-9]}", "1:57"))
  Println("Match")
else
  Println("No Match")
endif

 

   
Converted from CHM to HTML with chm2web Pro 2.85 (unicode)