Skip to content

Instantly share code, notes, and snippets.

@blippy
Created November 4, 2016 20:07
Show Gist options
  • Select an option

  • Save blippy/8abfb315b45d1b3becb6dfe82ac5cd39 to your computer and use it in GitHub Desktop.

Select an option

Save blippy/8abfb315b45d1b3becb6dfe82ac5cd39 to your computer and use it in GitHub Desktop.
Simple pattern matching with Snobol4
inp = 'baz,F.bar,go,F.mAgic'
ALPHAS = 'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'
myloop inp ('F.' SPAN(ALPHAS)) . hit REM . inp :F(finis)
output = 'Computer says:' hit :(myloop)
finis output = 'Finished'
END
@blippy

blippy commented Nov 4, 2016

Copy link
Copy Markdown
Author

Run using

snobol4 -b spat.sno

Output is

Computer says:F.bar
Computer says:F.mAgic
Finished

The code is discussed by me in a Wordpress article.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment