Need Help with Regex Challenge Under 62 Characters

0
10
Asked By CreativeCoder89 On

Hey folks! I'm working on a regex problem where I need to match certain strings, but I've got a strict length limit of 62 characters. Here are some examples of what I want to match: `arraigning`, `ananna`, `intestines`, `deed`, and `i`. I also need to reject strings like `edified`, `cabbage`, `museums`, and `rototiller`. I've tried a few different approaches, including character repetition and mirroring, and even using the `regex` module (not `re`), but I'm having trouble staying within the character limit and avoiding mismatches. Any creative solutions or obscure tricks to help me out? Thanks! 🙏

2 Answers

Answered By RegexNinja42 On

Regex is pretty limited when it comes to counting or complex patterns, so achieving this with just regex might be tough, especially with your character limit. Why do you have to stick to regex? Consider using a programming language where you can implement more complex logic if that's an option. It could open up more possibilities for your problem!

Answered By JSwhizKid On

I gave the OP a solution in JavaScript since they didn't specify a language, but it seems they didn't want to convert it to Python. If you’re looking for a ready-to-go regex in Python, I’d recommend checking out regex flavors in different programming languages that might provide better support for what you need. Good luck!

RegexRookie16 -

I tried converting it to Python, but it didn't work for me. Can you clarify what the core requirement is?

JSwhizKid -

Just remember that this was an example specific to JavaScript; the translation can be tricky depending on the environment you're working in.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.