More actions
- Came from RedTeam meeting on LLM jailbreaking
- Won cool stickers!
- LUG stickers #soon
- Ron's talk on Regex!
- What is an alphabet
- Strings are a finite series of characters
- We typically use "w" to represent strings, for "word"
- Lamba (λ) = empty string
- Languages are represented by "L"
- Machine takes strings (w) and determines if it's in the language (L)
- Finite Automata
- Example automata that only accepts an even length string
- Regular Expressions
∅
= empty set ={}
r = hello
- only accepts the word "hello"
r = a * b
L(r) = {"a", "b"}
- The language contains both "a" and "b"
- Kleene Star (*)
- Only way to represent an infinite number of an expression
r = a*
L(r) = {λ, "a", "aa", "aaa", ...}
r = (ab + c)*
ab + c
matches any instance of "ab" or "c"(ab + c)* = L{λ, "ab", "c", "abab", "abc", "cccab", ...}
r = (d + ∅)
L(d) = {"d"}
L{∅} = {}
{"d"} ∪ {} = {"d"}
- You cannot append "nothing" (AKA
∅
) to a string but you can append an empty string (AKAλ
)
- grep + Regex
- grep uses an 'extended' version of regex
[]
- "any of",[abcd]
,[0-9]
[^]
- "none of",[^aeiuo]
?
- "maybe",colou?r
- matches both
color
andcolour
- matches both
|
= ++
- 1-or-more- the Kleene star is essentially '0-or-more'
- Live demo!
- Grepping for strings inside hamlet
grep hamlet
grep 'z.*z'
- matching any number of characters between two z's- Specific behavior depends on the implementation, most are greedy
z.*z
would likely match "zz" on a line that had "zzz", but some implementations may match "zzz"
- Matching all lines with 13 words in them
- Grepping for strings inside hamlet
- Common Extensions
- Groups
- In Grep, need to use
-P
flag for "Perl" mode (-E
for "extended" does not allow you to use groups)
- In Grep, need to use
- Lookaround
- Matches text without being part of the matched text
- Replacing all instances of "John Smith" with "Jack Smith" in a text file that also has "John Cena"
- Replacing all instanced of "hamlet" with "bamlet" using
:s/hamlet/bamlet/g
in vim
- Groups
- Language Theory
- What makes a language regular?
- if it can be described using a Regular Expression!
- Regular Automata
- Limited state, can only read input once
- Chomsky's Hierarchy
- Regular expressions are at the bottom of this pyramid
- Context-free, Context-sensitive, and Recursively enumerable expressions sit above regular expressions, in that order
- Turing machines above all of those
- Regular expression cannot replace your programming language
- Some regular language implementation decide languages that aren't regular! >:(
^(a(?1)?b)$
- More akin to "context-free" expressions
- Ron will literally murder them (very real and true)
- Does Tech teach anything that covers beyond context-free in undergrad?
- no :(
- What WM does Ron use?
- Xmonad, customized in a weird way exactly to his liking
- A true gentoo user
- Xmonad, customized in a weird way exactly to his liking
- Why do people call gentoo a "meta-distribution"?
- They call themselves that, but they're really more like a regular distribution
- Only time Josh ever heard of "meta-distribution" was in reference to Bedrock Linux, since it's a distro you install other distributions inside of
- Does Tech teach pumping lemmas?
- They were supposed to
- Josh doesn't remember it
- Allen continues his ventures in gaming on one of the GLRC servers
- Why?
- Free power
- How are you going to get around anticheat?
- "idk"
- Why?
- Domino's BOGO deal for more LUG Pizza parties? [1]
- Wrapped up briefly talking about recent FOSS drama
- Stallman report
- Drew report
- Linus is back to his old self on the Linux mailing list
- Russian maintainer stuff
- BTRFS filesystem
- Stallman report
- eboard Taco Bell trip