Skip to main content

All Questions

Tagged with
2 votes
2 answers
3k views

Python regex greek characters [duplicate]

I have some strings which have this structure: <name> (<unit>). I would like to extract name and unit; to perform this task I use regex and in most cases it is all fine. However, in some ...
Zephyr's user avatar
  • 12.5k
6 votes
4 answers
2k views

Replacing string with placeholder and replacing them back after a function.

Given a string and a list of substring that should be replaces as placeholders, e.g. import re from copy import copy phrases = ["'s morgen", "'s-Hertogenbosch", "depository financial institution"] ...
alvas's user avatar
  • 123k
2 votes
1 answer
1k views

Non greedy match of .* with ^

Given the string: s = "Why did you foo bar a <b>^f('y')[f('x').get()]^? and ^f('barbar')^</b>" How do I replace the ^f('y')[f('x').get()]^ and ^f('barbar')^ with a string, e.g. ...
alvas's user avatar
  • 123k
-1 votes
1 answer
397 views

Generate placeholders for numbers with random digits in sentence

Problem I need to create placeholders in a sentence (string). Example My son is 6 years old and my dad is 61 years old. My son is #0 years old and my dad is #1 years old. This is only one sentence. ...
Alessio44's user avatar