How do I write this regex pattern?

I have a padas dataframe, from which I want to extract certain values: (' APT 2E'), (' 2ND fl'), (' #5B'), (#568'), (#1 FL' ), (FL 2' )

What kind of regex pattern would I write to select only these kind of values?

j's photo

([\w #]+) will get all the characters between the brackets and the extra spaces.

The problem I have your specification 'this kind of pattern' providing an inconsistent data sample makes it hard to discern what you actually want.

the idea of giving examples you should at least give an expected result. either you think like a function

F(input) -> output

or at least some hint what the expectation of the result should be.

Btw in your case there are multiple solutions an they depend on scale, maybe regex is the wrong solution if you got a repeating pattern you can use cursor based buffer parsers packed into generators/coroutines.

Hipkiss's photo :)
Have fun.