[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y ] [Search | Free Show | Home]

ReGeX matching game

This is a blue board which means that it's for everybody (Safe For Work content only). If you see any adult content, please report it.

Thread replies: 29
Thread images: 4

File: 1453467703507.jpg (11KB, 411x184px) Image search: [Google]
1453467703507.jpg
11KB, 411x184px
https://f-droid.org/wiki/page/com.phikal.regex
this is fun but sometimes i feel like the only choice is hamfisted.

for example, using 17 characters:

Match        Don't Match
pob0 gm1
Y0GH Chf4
Dhtg 5O


the only solution i could come up with was
^[pYD]\w+


can /g/ do better?
will post more as i get to them if there is interest
>>
I don't get it
>>
>>57850093
what don't you understand?
do you not know what the game/I am asking you to do?
>>
>>57850116
what "regex" is
>>
>>57850170
regular expression.
it says in the image.
>>
>>57850176
yes but you can explain what is ^[pYD]\w+ mean?
>>
>>57850185
>can explain what is ^[pYD]\w+
okay.
>^
beginning of the string
>[pYD]
match any of the characters within the brackets
>\w
match any number, letter, or underscore
>+
match the previous one or more times
>>
>>57850210
You're a very patient man
>>
does someone have a regex matching game but only for lex/flex? gotta exercise on that
>>
>>57850083
^(pob0|Y0GH|Dhtg)$
>>
>>57850266
>17 characters
>>
Why would you not just use
^[pYD].*[0Hg]
? It's more readable.
>>
>>57850620
why would i do that?
>>
>>57850685
Because it's a more straightforward answer.
>>
>>57850692
how is that a more straightforward answer?
>>
I just use this whenever I need to
https://regex101.com/
>>
>>57850698
You take the first and last characters, then match everything between them. Add a $ at the end of the expression maybe.
What OP posted doesn't even work.
>>
>>57850731
> not just running
$ echo "test1
> test2
> test3" | grep "expression"
>>
File: 1454800912822.png (5KB, 358x341px) Image search: [Google]
1454800912822.png
5KB, 358x341px
>>57850736
>You take the first and last characters, then match everything between them
but that's not what i wanted to do. i just wanted to get the 3 i was supposed to.
>What OP posted doesn't even work
yes it does.
>>
File: scrot_20161205_161005.png (17KB, 275x277px) Image search: [Google]
scrot_20161205_161005.png
17KB, 275x277px
>>57850756
>>
I mean if you have a regex like that I'd just do a "only 4 characters" one.
>>
>>57850083
Unsure if syntax is correct but you can save like three characters like this

[^mf5]
>>
>>57850775
works on my machine.
>>
>>57850786
maybe add a * idk
>>
>>57850083
Why should any non-autistic person care about this?
>>
>>57851612
kill yourself
>>
>>57850266
/thread
>>
>>57850083
Also known as regex golf
>>
File: file.png (13KB, 345x298px) Image search: [Google]
file.png
13KB, 345x298px
>>57850083
ez
Thread posts: 29
Thread images: 4


[Boards: 3 / a / aco / adv / an / asp / b / bant / biz / c / can / cgl / ck / cm / co / cock / d / diy / e / fa / fap / fit / fitlit / g / gd / gif / h / hc / his / hm / hr / i / ic / int / jp / k / lgbt / lit / m / mlp / mlpol / mo / mtv / mu / n / news / o / out / outsoc / p / po / pol / qa / qst / r / r9k / s / s4s / sci / soc / sp / spa / t / tg / toy / trash / trv / tv / u / v / vg / vint / vip / vp / vr / w / wg / wsg / wsr / x / y] [Search | Top | Home]

I'm aware that Imgur.com will stop allowing adult images since 15th of May. I'm taking actions to backup as much data as possible.
Read more on this topic here - https://archived.moe/talk/thread/1694/


If you need a post removed click on it's [Report] button and follow the instruction.
DMCA Content Takedown via dmca.com
All images are hosted on imgur.com.
If you like this website please support us by donating with Bitcoins at 16mKtbZiwW52BLkibtCr8jUg2KVUMTxVQ5
All trademarks and copyrights on this page are owned by their respective parties.
Images uploaded are the responsibility of the Poster. Comments are owned by the Poster.
This is a 4chan archive - all of the content originated from that site.
This means that RandomArchive shows their content, archived.
If you need information for a Poster - contact them.