For your case, you can still use the findPosix function, but you only need the first element of the returned array, which contains the found substringdo you have a simplified version? wherein we can only get the exact word ? like a reference number on text sms ?
Usage example:
Code:
/system script run ScriptFindPosix;# This command can be run when loading the router once to initialize the global variable FindRegex, which will store the search function:global findPosix;# global variable declaration#-----------replace the value of YOURString and regex variables-----------:local YOURString "INSERT YOUR TEXT";:local regex "INSERT YOUR REGULAR EXPRESSION HERE";:local startPosition 0;:local ArrRezult [$findPosix $YOURString $regex $startPosition ];# return value: ArrRezult is array {FoundSubString ; PositionStart ; PositionEnd }:local FoundSubString [:pick $ArrRezult 0];:put $FoundSubString # the $FoundSubString contains the found string
Statistics: Posted by vadimsachkov — Tue Feb 27, 2024 9:30 am