Skip to main content

Questions tagged [regex]

Regular expressions are a declarative language, mainly used for pattern matching within strings. Please include a tag specifying the programming language you are using, together with this tag.

6 votes
2 answers
395 views

I am trying to write a simple tokenizer for a basic arithmetic calculator. Here's the code: ...
user2338150's user avatar
10 votes
6 answers
1k views

I'm working on a Python script that reads a text file and extracts all the unique email addresses. The code works as intended, it produces the correct output, throws no errors, and I've tested it on ...
rao abdullah's user avatar
6 votes
2 answers
732 views

Here's my (correct) solution to a HackerRank question: Weather Observation Station 8 Query the list of CITY names from STATION which have vowels (i.e., a, e, i, o, and u) as both their first and last ...
JTB's user avatar
  • 277
3 votes
1 answer
175 views

I have created a simple text editor with a "replace all" feature. It's meant to be part of a larger project, so it needs to be robust and work reliably across various scenarios. Please ...
Mori's user avatar
  • 197
5 votes
1 answer
140 views

This is my first Rust project (I'm primarily a C guy). I want to know if my code is properly idiomatic (Rusty?). Also, are there any inefficiencies? The code defines an iterator (...
Daniel Walker's user avatar
0 votes
0 answers
94 views

I want to share my invention, which allows you to use only one RegEx, which will search for substrings in a string with a certain condition. If you want, call it a RegEx loop that didn't exist before! ...
Raf's user avatar
  • 9
4 votes
1 answer
100 views

I've made a code in Python 3 which converts a polynomial with integer coefficients (in simplified integer form) from string form to a list of tuples of the form (coefficient, exponent, variable). It ...
Sam's user avatar
  • 147
2 votes
2 answers
161 views

I would like to know if there is a better regex to match all worded numbers from 1 to 99. With "better" I mean shorter with same performance, OR faster. I came up with this. I can't do ...
Bobby234's user avatar
1 vote
1 answer
69 views

I have a Polars dataframe in which the cells contain a sequence of single digits as a string of characters, and I want to find the number of differences between the single-digits elements of the ...
Josh9999's user avatar
5 votes
1 answer
393 views

I attempted to implement a python version of this function in my previous question. Given a regular expression with range(s) of alphabets/numbers, the function will expand the brackets and return a ...
nightstand's user avatar
2 votes
0 answers
111 views

I tried writing a short function that expands brackets [] within a regular expression. Given a regular expression, the function will expand the brackets and return ...
nightstand's user avatar
3 votes
1 answer
141 views

I have written code to manage a string and retrieve from it a dictionary which must contain pairs key-value dependent from the string. To be more clear I'll show ...
User051209's user avatar
2 votes
1 answer
105 views

I've implemented a function that creates a multiple regular expressions predicate. The idea behind the predicate is combining regular expressions using the disjunction operator ...
terrorrussia-keeps-killing's user avatar
1 vote
1 answer
181 views

Task-description: Implement a function, which returns a string with all consecutive whites-spaces replaced as a single-space. Example: "a[space][space][space]b[space][space][space]c" shall ...
michael.zech's user avatar
  • 5,042
2 votes
1 answer
87 views

I made a function that prompts me for values of variables (formatted %^{var1}) it found in a string and fills in said values. ...
my_display_name's user avatar

15 30 50 per page
1
2 3 4 5
58