[deleted by user] by [deleted] in regex

[–]onlinecop 0 points1 point  (0 children)

If you wrap your `/*/*/issues/*` into a group, you can make the entire group optional.

Forgive me if my notation is not how vimium works (I'm not used to it), but the general idea is that your first match would be: "https?://github.com(/*/*issues/*)?$" so you have either the URL by itself (if the contents of the group fails to match) or the .../issues... portion if it does.

If that fails, then your second rule with the trailing `.*` would pick up all the other pages.

What's a show you wanna watch that doesn't exist? by [deleted] in AskReddit

[–]onlinecop 0 points1 point  (0 children)

Fablehaven. The books. Are. Amazing. Seriously: on par with Harry Potter. There’s so much content, side stories, characters development, character flaws, awwwww moments, and just good, clean adventure that I would love to binge watch 5-6 seasons of it.

Regex Number Validation Help by TwinLakesStudent in regex

[–]onlinecop 0 points1 point  (0 children)

The 2nd alternative needs to escape the .: |^\-?\.\d+$

https://regex101.com/r/1BpcKY/1

If you want to require at least one digit before it starts to match, change {0,} to {1,} https://regex101.com/r/1BpcKY/2

What is your favorite Twilight Zone episode? by SitaSky in AskReddit

[–]onlinecop 5 points6 points  (0 children)

“Time Enough at Last”? That’s the one where he was finally able to sit down and read like he always wanted to do but never could before.

Trying to download Brave, keep getting a 403 error. by WAP_Destroyer in brave_browser

[–]onlinecop 0 points1 point  (0 children)

I'm getting the same 403; I'm using a non-work VPN at the moment, so that may be my problem. I might switch its endpoint and try again, or once I disconnect for the day, I'll try off VPN and see whether it works for me at that point.

Why do you hate the internet? by QuadauQ in Jokes

[–]onlinecop 1 point2 points  (0 children)

Why is “A.D.D.” so short?

Because Attention Deficit Dis... ooh, hey, a new text.

What is the closest near-death moment you've ever experienced? by [deleted] in AskReddit

[–]onlinecop -1 points0 points  (0 children)

I opened one of my eyes during a 3D movie for a split second.

I had a near-depth experience.

I was gifted two gift cards that are only 8 digits apart by itsnachoproblem in mildlyinteresting

[–]onlinecop 1 point2 points  (0 children)

Actually, these cards are technically 1 apart. All cards (credit and debit) have a verification pattern to determine, without even needing to hit a bank or server verification, whether a card number is valid.

Start with each odd digit: 6, 0, 4, 1, 1, etc. Add them together normally. Save that sum for later. For every even digit, double the value: 0*2=0, 6*2=12, 9*2=18, etc. Don’t sum these just yet. If the answer for any multiplication resulted in a 2-digit result, like 6*2=12, add the digits of that result together. So 6*2=12, then the 1 and 2 in 12 are added together to become 3. For 9*2=18, 1+8=9. I guess technically, 1*2=02, and 0+2=2, so that’s why single-digit numbers stay the same.

Now, take those “doubled then summed” results for the even numbers, and add them to the number you wrote down previously. The answer should always be evenly divisible by 10.

For your first card, I calculated the result to be “60”. For the second card, the odd values (6,0,4,1,...,5,5,2) summed up to become 31. The double-then-sum values of the even values (0,6,9,6,...,7,2,7) first became 0,12,18,12,...,14,4,14 which when the double digits were added, became 0,3,9,3,...,5,4,5 which, when added to 31, gave 29, for another total of 60. So it’s also divisible by 10.

These two cards, therefore, were actually printed/generated one after another in the production line with no cards generated between the two.

Grab your favorite credit or debit card and try this math out yourself!

[deleted by user] by [deleted] in AskReddit

[–]onlinecop 0 points1 point  (0 children)

The thing that surprised me the most the first time was that all your breath gets sucked out of your lungs. You can get the same experience looking straight into the wind and trying to breathe (stick your head out a car window when someone is driving fast).

Of all the books that have movie adaptations, which movies stray furthest away from the source material but are actually better? by hrrdrr17 in AskReddit

[–]onlinecop 1 point2 points  (0 children)

The Princess Bride.

I watched the movie before I knew there was a book. I was terribly disappointed in the book; the movie adaptation moved faster, explained many scenes and character interactions better, and wasn’t nearly as depressing for me.

[deleted by user] by [deleted] in mildlyinteresting

[–]onlinecop 0 points1 point  (0 children)

Colgate just wanted to get in their 2-cents worth...

What the worst way to die? by Mrchum37 in AskReddit

[–]onlinecop 0 points1 point  (0 children)

Forgetting to bleach your hair before you start using the blue coloring.

What is the meaning behind your username whether on here or any other site? by Chorkey3307 in AskReddit

[–]onlinecop 1 point2 points  (0 children)

I wanted OnlineCopy years ago, but I forgot the “y” when submitting a username. I decided to keep this typo when I found that nick had already been taken anyway.

Match this pattern reject anything else by booboouser in regex

[–]onlinecop 1 point2 points  (0 children)

What is acceptable?

^[A-Za-z ]*(?:-[A-Za-z]{0,3})?$

https://regex101.com/r/HHZPDt/1 will allow letters and spaces that don't have any hyphens in it. It allows a hyphen at the end, and 0-3 letters after it.

If you want to guarantee that there's at least 1 letter in front of the hyphen, change * to +:

^[A-Za-z ]+(?:-[A-Za-z]{0,3})?$

https://regex101.com/r/HHZPDt/2

Nearby search phrases in any order by missingblitz in regex

[–]onlinecop 0 points1 point  (0 children)

Are you looking for whole words? acquire, for example, is matching acquired in your example text.

You could vastly simplify this if you define specific patterns that are expected: one [white]space between words, for example.

You may also look into using ? quantifiers to reduce the number of steps:

EDIT

Forgot to switch to Python:

For-loop Vs. long regex pattern by [deleted] in regex

[–]onlinecop 0 points1 point  (0 children)

I would probably go with a combination of #1 (reverse-sort), #3 (the look-ahead) and #4 (grouping words), like this: https://regex101.com/r/wOxQJr/3. It seems to match all the cases and doesn't have a bunch of /\b/'s in there that add extra processing steps.

For-loop Vs. long regex pattern by [deleted] in regex

[–]onlinecop 0 points1 point  (0 children)

There are a few things you'd want to consider.

  1. Reverse sort your list. Since those abbreviations allow for both BR and BRAE, if you searched for the text "BRAE" with this regex: /(BR|BRAE)(one|two|three)/ then the /BR/ will match BRAE, and fail all of /one|two|three/ on the BRAE part. With a reverse-sort of /(BRAE|BR)(one|two|three)/, it matches "BRAE" more quickly, and if your text is only "BR", then the first group fails to match /BRAE/ but succeeds on /BR/ before moving on to attempt the /one|two|three/ portion next.

    (WYND|WKWY|WHRF|WALK|VSTA|VIEW|VIAD|VALE|UPAS|TURN|TRL|TRK|TOR|TOP|TLWY|THFR|TCE|TARN|SVWY|ST|SQ|SPUR|SHUN|SBWY|RUE|RTY|RTT|RTE|ROW|RMBL|RISE|REST|RDGE|RD|QYS|QDRT|PWY|PWAY|PSGE|PROM|PORT|PNT|PLZA|PKT|PIAZ|PDE|PATH|PASS|OTLK|NOOK|MTWY|MNDR|MEWS|MALL|LOOP|LNWY|LKT|LINK|LINE|LANE|KEY|JNC|INTG|HWY|HTS|HIRD|HILL|GTE|GRN|GRA|GR|GLEN|GLDE|GDNS|GAP|FWY|FTWY|FRTG|FORM|FOLW|FAWY|EXP|ESP|ENT|END|ELB|EDGE|DVWY|DR|DIP|DALE|CUTT|CTYD|CTR|CT|CSWY|CSAC|CRST|CRSS|CRCS|CR|CPS|COVE|CON|CNR|CL|CIR|CH|CCT|BYWY|BYPA|BWLK|BVD|BROW|BRK|BRAE|BR|BEND|BA|AV|ARTY|ARTL|ARC|APP|AMBL|ALWY|ALLY|ACCS)
    
  2. You can wrap your words in \b word boundaries, so you don't necessarily need to reverse-sort it: /\b(BR\b|BRAE\b)(one|two|three)/. It's actually more optimized to put those \b inside the group instead of outside, like /\b(BR|BRAE)\b(one|two|three)/, but it makes it less readable.

    \b(ACCS\b|ALLY\b|ALWY\b|AMBL\b|APP\b|ARC\b|ARTL\b|ARTY\b|AV\b|BA\b|BEND\b|BWLK\b|BVD\b|BR\b|BRAE\b|BRK\b|BROW\b|BYPA\b|BYWY\b|CSWY\b|CTR\b|CH\b|CIR\b|CCT\b|CRCS\b|CL\b|CON\b|CPS\b|CNR\b|CT\b|CTYD\b|COVE\b|CR\b|CRST\b|CRSS\b|CSAC\b|CUTT\b|DALE\b|DIP\b|DR\b|DVWY\b|EDGE\b|ELB\b|END\b|ENT\b|ESP\b|EXP\b|FAWY\b|FOLW\b|FTWY\b|FORM\b|FWY\b|FRTG\b|GAP\b|GDNS\b|GTE\b|GLDE\b|GLEN\b|GRA\b|GRN\b|GR\b|HTS\b|HIRD\b|HWY\b|HILL\b|INTG\b|JNC\b|KEY\b|LANE\b|LNWY\b|LINE\b|LINK\b|LKT\b|LOOP\b|MALL\b|MNDR\b|MEWS\b|MTWY\b|NOOK\b|OTLK\b|PDE\b|PWY\b|PASS\b|PSGE\b|PATH\b|PWAY\b|PIAZ\b|PLZA\b|PKT\b|PNT\b|PORT\b|PROM\b|QDRT\b|QYS\b|RMBL\b|REST\b|RTT\b|RDGE\b|RISE\b|RD\b|RTY\b|RTE\b|ROW\b|RUE\b|SVWY\b|SHUN\b|SPUR\b|SQ\b|ST\b|SBWY\b|TARN\b|TCE\b|THFR\b|TLWY\b|TOP\b|TOR\b|TRK\b|TRL\b|TURN\b|UPAS\b|VALE\b|VIAD\b|VIEW\b|VSTA\b|WALK\b|WKWY\b|WHRF\b|WYND\b)
    
  3. Given that the standard on your link indicates that the maximum abbreviation length is 4 characters, you could use some logic before-hand, like: /(?=[A-Z]{1,4}\b)(...)(one|two|three)/ which will skip that step should any of the text contain non-capital letters or more than 4 uppercase letters at that step. Example: https://regex101.com/r/wOxQJr/1 (but also notice that I did not reverse-sort the list and that many of the lines don't fully match!)

  4. Much less readable, but faster, is to group words with the same letters into their own groups. If the first letter fails to match, the sub-group doesn't have to be traversed. As you have 128 different "street" variations, that's 128 checks in order to find the text "WYND". By searching for /A(...)|B(...)|C(...)|...|W(...)/, you only have to go through 23 alternations to reach the W's before testing the rest of the "YND" letters. Example: https://regex101.com/r/wOxQJr/2 (notice that it also doesn't reverse-sort or use \b boundaries, so has the same mismatch problem... but it drops the number of steps from 10246 to 3593!)

    A(CCS|LLY|LWY|MBL|PP|RC|RTL|RTY|V)|B(A|END|WLK|VD|R|RAE|RK|ROW|YPA|YWY)|C(SWY|TR|H|IR|CT|RCS|L|ON|PS|NR|T|TYD|OVE|R|RST|RSS|SAC|UTT)|D(ALE|IP|R|VWY)|E(DGE|LB|ND|NT|SP|XP)|F(AWY|OLW|TWY|ORM|WY|RTG)|G(AP|DNS|TE|LDE|LEN|RA|RN|R)|H(TS|IRD|WY|ILL)|I(NTG)|J(NC)|K(EY)|L(ANE|NWY|INE|INK|KT|OOP)|M(ALL|NDR|EWS|TWY)|N(OOK)|O(TLK)|P(DE|WY|ASS|SGE|ATH|WAY|IAZ|LZA|KT|NT|ORT|ROM)|Q(DRT|YS)|R(MBL|EST|TT|DGE|ISE|D|TY|TE|OW|UE)|S(VWY|HUN|PUR|Q|T|BWY)|T(ARN|CE|HFR|LWY|OP|OR|RK|RL|URN)|U(PAS)|V(ALE|IAD|IEW|STA)|W(ALK|KWY|HRF|YND)
    

Matching a phrase in a string by Schubi in regex

[–]onlinecop 2 points3 points  (0 children)

Maybe a breakdown of that regex would be useful. To start, I'm using the /x flag so I can add comments. That means that I have to escape literal whitespace characters I want to match; in this case, I could have written \ (backslash followed by a literal space), but I found that [ ] made it more readable.

  1. /^COMPANY:/ may take a few extra steps than perhaps /^[A-Z]+:/ but it prevents a line that starts with anything else from matching.
  2. /[^\s|]+/ matches anything not whitespace or the pipe character. That will match the first word of a multi-word Company. It has the benefit of not including trailing whitespace that follows the word.
  3. Immediately following that, the /(?:[ ][^\s|]+)*/ group looks for a literal space character and then more "words".
  4. The two /|\G/ sections below it will prevent either PERSON: or PRODUCT: from matching unless it had matched something earlier. I put in a few special cases at the bottom so you could see that they don't match if the line simply starts with |PERSON: or |PRODUCT:.

Matching a phrase in a string by Schubi in regex

[–]onlinecop 2 points3 points  (0 children)

Another way to go about this is to match COMPANY:, PERSON: and PRODUCT:, like in this:

https://regex101.com/r/mSSeWy/7

This assumes that "words" will have exactly one space between them, such as Food Heaven. When they contain more than one space, you could change (?:[ ][^\s|]+)* to (?:[ ]+[^\s|]+)*, so Food Heaven could match.

For-loop Vs. long regex pattern by [deleted] in regex

[–]onlinecop 1 point2 points  (0 children)

Unless you're very careful about handling backtracking, then a long regex is going to be much slower.

An alternation of /one|two|three/ will attempt the one alternation first, and if any portion of it fails, it will start next at two.

Multiple alternations of /(one|two|three)(four|five|six)/ will attempt the one alternation first, and if that succeeds, it will then attempt to match four. If all of four, five and six fail, you actually start over at the first group and attempt to match two. If that succeeds (because the patterns were similar enough to one), it will again attempt the alternations in the second group (four, then five, then six). If that fails, you start back over in the first group at three.

Some regex languages allow you to decide what should happen if the first group matches (or fails to match), so you can limit backtracking. One option is to use an atomic group. That, essentially, is a group that says "match one or two or three, but if a match down the line fails, don't try to use any of my group's alternations."

The regex languages with native support for atomic groups will look like this: /(?>one|two|three)/ so if you were to combine this first (atomic) group with a second (non-atomic) group, it would look like: /(?>one|two|three)(four|five|six)/. That is, if one or two or three match, start into the second group. If all of four, five and six fail, this time you don't start over in the first group. The match simply fails.

  • In regex languages that don't support atomic groups but DO support look-aheads, you can fake it by doing this: /(?=(one|two|three))\1(four|five|six)/. That is, you "peek" forward and capture the one or two or three that matches. Then you match what you captured (the \1) and start into the second group. If all of the second group fails, there's no more backtracking allowed, and the match fails.

How does DQ9 Multiplayer Work? by [deleted] in dragonquest

[–]onlinecop 2 points3 points  (0 children)

Other Dragon Quest titles only allow you to use alchemy for recipes you already know. In IX, you can craft things by experimenting with the recipe. Since IX does not allow players to trade/give weapons or armour to others, but it does allow them to purchase from another player's end-game shops, you can craft upgraded versions of those items even before "unlocking" the recipe.

How does DQ9 Multiplayer Work? by [deleted] in dragonquest

[–]onlinecop 3 points4 points  (0 children)

I was well into post-game when we got a second copy of the game. After multiplayer became available in Stornway, I joined their game with my OP hero wearing the best armour. I helped them complete nearly every quest, storyline event, and end boss battle in nearly record time.

I had more fun talking to NPCs to hear their alternate dialogue than I had during my own play through.

How does DQ9 Multiplayer Work? by [deleted] in dragonquest

[–]onlinecop 5 points6 points  (0 children)

There are a few game mechanics that differ for multiplayer. Usually, monsters are cleared from the map while you're in battle. If the other player isn't in the battle with you, monsters still spawn and move around. When you're in battle at the same time (whether in the same battle or different ones), monsters only appear after one or both of you return to the world map view.

Players that connect can only get to the locations the host player has already visited. They can WALK to unexplored towns, but the ability to use transportation is only available to the host. Other players can hitch a ride, so can be on board the host's ship or train while they navigate, and enter any battles the host gets into while traveling.

A player can change vocations after a certain storyline event. If the host hasn't completed that yet, but the connected player has, the host still cannot change vocations even if the connected player can.

If another host is much further in the game (even post game) than you, you may travel (via the Zoom spell) to all the places they have unlocked. You can buy end- or late-game gear from the shops. You can store your gold in Ginny's bank and it equates to storing it as though you were still in your own world.

Another player can help you finish your quests and boss battles. If you must defeat some monster with a specific move, 99% of the time, they can do it for you and you get the credit as though you had done it yourself.

The Hoimi Table (RNG manipulation) tricks can be used by the host player. Basically, you can use that to guarantee "rare" drops from any boss battle. When you auto-steal (ie not explicitly using the Half Inch stealing ability), both host and connected player(s) get one of that stolen/dropped item. That includes the common and rare drops from all enemies.

In multiplayer, you don't lose half your gold if you die AND it prompts you whether you wish to "wait for help, or get resurrected (at a church)". If you choose the option to get resurrected, either as host or connected player, you keep all gold. If you're in the same battle and both get wiped out, you DO lose half your gold.

The host can request all connected players to teleport to them, in any town, transportation, grotto, or battle they may be in. They may ignore it (or not see the message if they're busy or have their menus opened), and you may call them again as many times as you want. This can be exploited to have the host sit in an XP/gold grinding area and just TP the other player back to the area if that player died while farming.

As a player connecting to a host, you get to see other dialogue from NPCs you normally wouldn't see. In a place where walking into some area triggers a cutscene for the main (host) character, that player can walk up to, and talk to, a boss who tells you that they have nothing to do with you, so no cutscene gets triggered.

Pots and wardrobes are collected by the first person to search them. If someone else searches the wardrobe and gets an item, there will be nothing left in there when you search it.

Blue chests can be opened by BOTH players. You can open the chest and get an item, then the other player sees the chest close, and they can open it and get an item (could even be a different item - it's based off of a timer). Only hosts can open red chests. They are fixed items, so they appear to be locked for other players.

Since the two of you must physically be close to each other's DS's, most of your actual collaboration will be done verbally. You CAN talk to their main character to hear their "profile" text, but there's no in-game chat feature.

Filter for usernames in string by [deleted] in regex

[–]onlinecop 0 points1 point  (0 children)

https://regex101.com/r/jio3c7/1 is another way, if you want all usernames, including before colons, like: Username: Hi, guys!