PregFind: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
No edit summary |
||
Line 23: | Line 23: | ||
function( ) | function( ) | ||
-- hello words find | -- hello words find | ||
outputDebugString( pregFind( 'hello world, hello world, hello world', 'hello world' ) or 'not found' ) -- | outputDebugString( pregFind( 'hello world, hello world, hello world', 'hello world' ) and 'found' or 'not found' ) -- found | ||
-- integer number find | -- integer number find | ||
outputDebugString( pregFind( '123', '^-{0,1}\\d+$' ) or 'not found' ) -- | outputDebugString( pregFind( '123', '^-{0,1}\\d+$' ) and 'found' or 'not found' ) -- found | ||
-- Login with a-z and A-Z symbols and have more 3 symbols | -- Login with a-z and A-Z symbols and have more 3 symbols | ||
outputDebugString( pregFind( 'Kenix', '[a-zA-Z]{3,}' ) or 'not found' ) -- | outputDebugString( pregFind( 'Kenix', '[a-zA-Z]{3,}' ) and 'found' or 'not found' ) -- found | ||
-- Russian hello ( привет ) find | -- Russian hello ( привет ) find | ||
outputDebugString( pregFind( 'привет привет', 'привет' ) or 'not found' ) -- | outputDebugString( pregFind( 'привет привет', 'привет' ) and 'found' or 'not found' ) -- found | ||
-- Sequence of numbers | -- Sequence of numbers | ||
outputDebugString( pregFind( '5, 10', '^([1-9]{1}[0-9]{0,})+(((,\s|,)[1-9]{1}[0-9]{0,}){0,1}){1,1}' ) or 'not found' ) -- | outputDebugString( pregFind( '5, 10', '^([1-9]{1}[0-9]{0,})+(((,\s|,)[1-9]{1}[0-9]{0,}){0,1}){1,1}' ) and 'found' or 'not found' ) -- found | ||
end | end | ||
) | ) |
Revision as of 12:24, 25 February 2013
This function find only one match and when match is founded stop working and return a result.
Syntax
bool pregFind ( string base, string pattern )
Required Arguments
- base: The base string for find match.
- pattern: The pattern for find in base string.
Returns
Returns an bool if the function was successful found one match, false otherwise.
Example
Click to collapse [-]
Shared ( client and server )Some examples:
addCommandHandler( 'examples', function( ) -- hello words find outputDebugString( pregFind( 'hello world, hello world, hello world', 'hello world' ) and 'found' or 'not found' ) -- found -- integer number find outputDebugString( pregFind( '123', '^-{0,1}\\d+$' ) and 'found' or 'not found' ) -- found -- Login with a-z and A-Z symbols and have more 3 symbols outputDebugString( pregFind( 'Kenix', '[a-zA-Z]{3,}' ) and 'found' or 'not found' ) -- found -- Russian hello ( привет ) find outputDebugString( pregFind( 'привет привет', 'привет' ) and 'found' or 'not found' ) -- found -- Sequence of numbers outputDebugString( pregFind( '5, 10', '^([1-9]{1}[0-9]{0,})+(((,\s|,)[1-9]{1}[0-9]{0,}){0,1}){1,1}' ) and 'found' or 'not found' ) -- found end )
See Also
- addDebugHook
- base64Decode
- base64Encode
- debugSleep
- decodeString
- encodeString
- fromJSON
- generateKeyPair
- getColorFromString
- getDevelopmentMode
- getDistanceBetweenPoints2D
- getDistanceBetweenPoints3D
- getEasingValue
- getNetworkStats
- getNetworkUsageData
- getPerformanceStats
- getRealTime
- getTickCount
- getTimerDetails
- getTimers
- getFPSLimit
- getUserdataType
- getVersion
- gettok
- isTransferBoxVisible
- setTransferBoxVisible
- hash
- inspect
- interpolateBetween
- iprint
- isOOPEnabled
- isTimer
- killTimer
- md5
- passwordHash
- passwordVerify
- pregFind
- pregMatch
- pregReplace
- removeDebugHook
- resetTimer
- setDevelopmentMode
- setFPSLimit
- setTimer
- ref
- deref
- sha256
- split
- teaDecode
- teaEncode
- toJSON
- tocolor
- getProcessMemoryStats
- utfChar
- utfCode
- utfLen
- utfSeek
- utfSub
- bitAnd
- bitNot
- bitOr
- bitXor
- bitTest
- bitLRotate
- bitRRotate
- bitLShift
- bitRShift
- bitArShift
- bitExtract
- bitReplace