Replace block

was trying to use REPLACE BLOCK to strip the letters and characters of a PASS. but I’m not getting it

OB1

#PWD FUNCTION Replace "a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|!|#|$|%|¨|&" "" UseRegex=TRUE "<PASS>" -> VAR "PWD"

RESULT:

PWD (Single) = 72010

OB2

BLOCK:Replace
LABEL:PWD
  original = $"<input.PASS>"
  toReplace = "a|b|c|d|e|f|g|h|i|j|k|l|m|n|o|p|q|r|s|t|u|v|w|x|y|z|A|B|C|D|E|F|G|H|I|J|K|L|M|N|O|P|Q|R|S|T|U|V|W|X|Y|Z|!|#|$|%|¨|&"
  => VAR @PWD
ENDBLOCK

RESULT:

PWD (String) = june72010

I want to delete only letters and characters contained in the PASS

Check if there is a checkbox to enable regex or if there is another block called something like regex replace, I don’t recall at the moment

You can use this to match only digits

BLOCK:RegexReplace
  original = @input.PASS
  pattern = "([a-zA-Z]+|\\W+)"
  => VAR @regexReplaceOutput
ENDBLOCK

image

If you see that in some it works for you and in others it does not, I apologize I am not that good with regex

1 Like