Skip to content
Advertisement

Regex finding entire line from paragraph

I need to find the actual line from the paragraph, and the paragraph drawing by the markdown editor you can add a checkbox, radio, textbox, and paragraph through the editor.

The actual str is something like this,

  this is paragraph line1

  ?[question_2]{"category":[]}[who are you]=[] {1,2}
  [] OPTION 1
  [] OPTION 2
  [] OPTION 3

  this is paragraph line3

  ?[question_3]{"category":[]}[picode]=_ [PLACEHOLDER_TEXT]

  ?[question_1]{"category":[]}[sex]=() {1}
  () male 
  () femele 


  this is paragraph line3

Do all question types have to start with ?[sometext], so I can use this regex

radio -> [?] ?[([0-9a-z_].?)]({(?:[^{}]|?)})? ?[?(.?)]? ?[=] ?() ?({[0-9,]+})?([^]?)(nn|^n)

checkbox -> [?] ?[([0-9a-z_].?)]({(?:[^{}]|?)})? ?[?(.?)]? ?[=] ?[] ?({[0-9,]+})?([^]?)(nn|^n),

similar to all inputs, my question is how can I get the paragraph line text (those do not start with ? [] which may have small/caps/digits include)

Advertisement

Answer

You can do it like this:

^(?!(?)|([)).+(n|$)

^ will get you the start of the line, (?! will look ahead for the ? or [ characters, .+ will match the rest of the characters until n (Line break) or $ (end of file).

regex101 demo

EDIT

To group all the lines from a paragraph, try this:

^((?!(?)|([))(.+(n|$)))+

regex101 demo

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement