2

I have a dataframe with a column like that

COL1
PACK[5.95 $ /if game game1 + game1]
PACK[3 $ /2 products.]

I want create other column as following according COL1

pack_plus    pack
5,95          3          

I am ok for pack_plus : PACK\[(\d[\d.]*) $[^][]*\+[^][]*]

but not for pack (I dont want to select raw with "+")

I have this : PACK\[(\d[\d.]*) €[^][()]*]

Thank you

1
  • the values are on multiple lines, how are you creating the new index? can you show a few more rows Commented Dec 10, 2020 at 11:22

1 Answer 1

1

You can use

PACK\[(\d[\d.]*)\s*\$[^][+]*]

See the regex demo.

Details

  • PACK\[ - PACK[ string
  • (\d[\d.]*) - Group 1: a digit and then zero or more digits or dots
  • \s* - zero or more whitespaces
  • \$ - a $ char
  • [^][+]* - zero or more chars other than ], [ and +
  • ] - a ] char.
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.