This channel is intended for people just starting with the Raku Programming Language (raku.org). Logs are available at irclogs.raku.org/raku-beginner/live.html Set by lizmat on 8 June 2022. |
|||
Tirifto | I wonder: is there some way I can match several strings/elements at most once in whatever order in a regular expression? | 00:45 | |
Basically something like this: /«[ a || ab || ac || abc || acb || b || ba || bc || bac || bca || c || ca || cb || cab || cba ]»/, but written more like this: /«[ a || b || c ]¤»/, where ¤ means ‘match this once or more, but without any of the alterations repeating’. | 00:51 | ||
alternations* I guess I could insert pieces of code to keep track of this, but this feels like something a more elegant solution might exist for. `o` | 00:52 | ||
(I also suppose I could just generate combinations for <a b c> in this example, but I’m more generally curious if regexes have any combination-like manipulations or the like.) | 01:02 | ||
02:06
Util left
02:25
teatwo left,
teatwo joined
02:30
teatwo left,
teatwo joined
02:47
teatwo left,
teatwo joined
03:48
teatwo left
03:50
teatime joined
|
|||
wambash | m: my %strings := bag <a b c>; say "cabacbca".match: / .+ <?{ $/.comb ⊆ %strings}> /,:ex | 04:28 | |
Raku eval | (「cab」 「ca」 「c」 「ab」 「a」 「bac」 「ba」 「b」 「acb」 「ac」 「a」 「cb」 「c」 「bca」 「bc」 「b」 「ca」 「c」 「a」) | ||
14:30
teatime left
14:31
teatime joined
14:36
teatwo joined
14:39
teatime left
15:17
guifa joined
16:33
ab5tract joined
17:15
ab5tract left
21:01
habere-et-disper joined
21:19
deoac joined
|
|||
deoac | How would I create a regex which is an alteration of the elements of a list? E.g. create `/'foo'|'bar'|'baz'/` from `<foo bar baz>` | 21:23 | |
librasteve | m: my @l = <foo bar baz>; my $r = /<@l>/; say 'foo' ~~ $r; | 22:11 | |
Raku eval | 「foo」 | ||
deoac | Thanks, I clearly was overthinking it. | 23:06 | |
23:31
habere-et-disper left
|