Skip to content
Advertisement

Tag: string

Regular Expression: match word in a blank of a sentence

I have the following line: I _ foo and _ I want to match anything (case insensitive) that matches the text and has a words that replace the underscores e. g. So in this case I want to get the whole sentences back: [“I want foo and bar”, “I implemented foo and foo”, “i use Foo and bar”] To be

Creating a list given an equation with no spaces

I want to create a list given a string such as ‘b123+xyz=1+z1$’ so that the list equals [‘b123’, ‘+’, ‘xyz’, ‘=’, ‘1’, ‘+’, ‘z1’, ‘$’] Without spaces or a single repeating pattern, I do not know how to split the string into a list. I tried creating if statements in a for loop to append the string when it reaches

Advertisement