Skip to content
Advertisement

Tag: string

Add a space after a word if it’s at the beginning of a string or if it’s after one or more spaces, and at the same time it must be at end or before n

How to obtain this outputs from those inputs? Note that for examples 4, 5, 6 and 7 the regex should not make any changes, since after the word there is already a space placed, or because in the case of “uno”, the word “un” is not at the end of the sentence, or in the case of “treinta yun” the

regex whole string match between numbers

I want to extract a whole word from a sentence. Thanks to this answer, I can get whole words in cases like: where symbols next to the word don’t bother. However if there’s a number it doesn’t find the word. How should I modify the expression to match cases where there’s a number next to the word? Like: Answer Can

Str.format with a list to create filter

Somewhat simple question with many similar ones out there, but I cannot seem to find what I am looking for. I am trying to filter a list of images in a dbc.Carousel via an int list of location numbers. Any image title that starts with a given number will correlate to a location. So, initially, I would want all images

occurrence of specific character in multiple strings

The multiple strings that needed to be searched are stored in a file values.txt (the Input File) which for example contains information as follows: I’m trying to count the occurrence of V in every line for index[x], x being the position of a character in every line. For example, there are 10 “V” in every first character of the lines.

Create patterns to detect the occurrence of sequences so that you can restrict in which cases to replace the detected substrings in the input string

These are the input string examples: I have tried with a simple replacement, but I think that the cases must be further restricted with a regex pattern so that unwanted replacements are not made… , and to be able to obtain this string as output… the correct output for each of these examples: In this case, the pseudo-pattern is: some

Advertisement