Quantcast
Channel: AutoIt v3 - General Help and Support
Viewing all articles
Browse latest Browse all 12506

Regular expression to parse variables and their values, but only certain types

$
0
0
#include <Array.au3> Global Const $CONST_INT = 100 ; Good Global Const $CONST_HEX = 0xFFFFFF ; Good Global Const $CONST_FUNC = BitOR($CONST_INT, $CONST_HEX) ; Bad Global Const $CONST_UDF_WITH_HEXCHRS = AFC() ; Bad Global Const $CONST_NUMBER_NEG = -100 ; Good Global Const $CONST_MACRO = @ScriptDir ; Good Global Const $CONST_BOOL = True ; Good Local $sData = FileRead(@ScriptFullPath) Local $aSRE = StringRegExp($sData, '(?i)\$(\w+)\h*=\h*(@\w+|True|False|[\dA-Fx\-]+),?', 3) _ArrayDisplay($aSRE) Func AFC()     Return True EndFunc   ;==>AFC
How can modify the regular expression to return only macros, boolean, numbers (signed/unsigned) and hexadecimal values?

Viewing all articles
Browse latest Browse all 12506

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>