0

Hello is it possible to match data between points like 6.1.1 - 6.1.2.

Here is real world example : https://regex101.com/r/n1XHaG/1.

I have points like this 6.1.1 and 6.1.2(30-40 points , but same way structured) and they are always on left side and text which I need is always on right. It's not a problem each point to be different match just to adjust the start and end word. This is actually what I'm trying to achieve , but I'm getting text from the title point as well and empty spaces and then I need to edit it after that which is not that great solution. I'm using it for automation in UiPath to take data from pdf and insert it in word.

I'm not sure if it's possible to take the string only on right side or while taking the string to ignore some words from the title since they are in the same line as the data which I need.

This is what I need to achieve : https://ibb.co/sFPrSRf

Best regards

Shwapx
  • 25
  • 6
  • This is not possible to match and not match at the same time. Do it in 2 steps: 1) extract with the pattern you have now. 2) Use `(?m)^.*?\S[\p{Zs}\t]{2,}` in some `replace` operation to replace with an empty string. – Wiktor Stribiżew Sep 08 '21 at 20:29
  • Not completely sure I understand your question, but do you want something like this `(?<=\d\.\d\.\d )(?:[^\s]+\s+)([.*\w\W\n]+)(?=\n\s+\d\.\d\.\d)`? – buddemat Sep 08 '21 at 20:58
  • Hello @WiktorStribiżew can you show me example how I can replace let's say I have the match with first regex and then how to replace with your suggested regex. – Shwapx Sep 09 '21 at 05:30

1 Answers1

0
^(.){0,45}(.*)$

Now concat 45 dots and group 2 followed by \n

.............................................$2\n # or even without \n based on your modifiers

Result: enter image description here

Ryszard Czech
  • 18,032
  • 4
  • 24
  • 37
DevWL
  • 17,345
  • 6
  • 90
  • 86
  • Can we have starting points and end with tis concat like starting point - 6.1.1 Необходимые and end point и чрезвычайных ситуациях. And take the text from the left side and then build another regex same way for point 6.1.2 ? – Shwapx Sep 09 '21 at 10:24
  • This answer would benefit if you add more about how OP is supposed to actually implement these steps in uipath. – Ryszard Czech Sep 09 '21 at 20:42