Minutes 2024-11-14
Jump to navigation
Jump to search
- Came from RedTeam meeting on LLM jailbreaking
- We won cool stickers!
- LUG is getting 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"
- Lambda (
λ) = 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 * bL(r) = {"a", "b"}- The language contains both "a" and "b"
- Kleene star (*) [1] [archive]
- Only way to represent an infinite number of an expression
r = a*L(r) = {λ, "a", "aa", "aaa", ...}
r = (ab + c)*ab + cmatches 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
colorandcolour
- matches both
|= ++- 1-or-more- The Kleene star is essentially '0-or-more'
- Note post-meeting: I personally use this operator a lot to replace multiple spaces with a single space in text files. For example, in vim, you can do
:%s| \+| |g(you need to escape the+in vim)
- Live demo!
- Grepping for strings inside hamlet
grep hamlet <filename>- searching for the string "hamlet"grep 'z.*z' <filename>- matching any number of characters between two z's- Specific behavior depends on the implementation, most are 'greedy'
- Ron's own term, meaning they grab the first instance of a match
- For a line with "zzz", the expression
z.*zwould likely match "zz", but some implementations may match "zzz"- Note from post-meeting: both Grep (
-G,-E,-P) and ripgrep return "zzz", so maybe it's the other way around?
- Note from post-meeting: both Grep (
- Specific behavior depends on the implementation, most are 'greedy'
- Matching all lines with 13 words in them
- Grepping for strings inside hamlet
- Common Extensions
- Groups
- In Grep, need to use
-Pflag for "Perl" mode (-Efor "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/gin 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?
- Why do people call gentoo a "meta-distribution"?
- Does Tech teach pumping lemmas in CS curriculum?
- They were supposed to
- Josh doesn't remember it
- Consensus was it was likely taught and Josh just forgor
- 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? [5] [archive]
- WMTU is using this for K-Fest
- Might make sense for us to use it too, even if we'd be buying fewer pizzas than them
- Wrapped up briefly talking about recent FOSS drama
- Eboard Taco Bell trip
