lundi 31 mai 2021

How do I store matching characters in a variable instead of replacing them in SNOBOL

I have been trying to find a way to separate vowels and consonants from provided input. I know how to match and replace but I don't know how to print matching characters instead of replacing them.

MY code goes like this which is removing the matching characters: I want TEXT variable to remain the same and store the matching characters in another variable

?      OUTPUT = "Please enter a string: "
?      TEXT = INPUT
?      VOWEL_WORDS = 'A' | 'a' | 'E' | 'e' | 'I' | 'i' | 'O' | 'o' | 'U' | 'u'
?      CONS_WORDS = 'B' | 'b' | 'C' | 'c' | 'D' | 'd' | 'F' | 'f' | 'G' | 'g' | 'H' | 'h' | 'J' | 'j' | 'K' | 'k' | 'L' | 'l' | 'M' | 'm' | 'N' | 'n' | 'P' | 'p' | 'Q' | 'q' | 'R' | 'r' | 'S' | 's' | 'T' | 't' | 'V' | 'v' | 'W' | 'w' | 'X' | 'x' | 'Y' | 'y' | 'Z' | 'z'
?
?MATCH TEXT VOWEL_WORDS = :S(MATCH) F(OTHER)
?OTHER
?      OUTPUT TEXT

Aucun commentaire:

Enregistrer un commentaire