How to stop regex pattern on its 1st match itself

Starting word: Table
end word: Change

input:

Table( is a series of related sentences developing a central idea, called the topic. Try to think about in terms of thematic unity: a is a sentence or a group of sentences that support one central, unified) change idea. add one idea at a time to your broader argument. series of sentences that are organized and coherent, and are all related to a single topic. Almost every piece of writing you do that is longer than a few sentences should be change idea.

requirement :
want to get the value between table in the 1st line and change in the 3rd line.

Difficulties :

Am getting values from Table from the 1st lien to Change in the last line - as mentioned in the screenshot

This works for me :partying_face:

(?<=Table).+?(?=Change)

2 Likes

@TimK,

Thanks for reply - with above pattern am able to get that , however with the same module type i tried for another set of input where again its not working, might be to i need to learn more in regex

Please help me here in below case also.

regex pattern i used :

(?<=Table\s1\s\nStudent\scorperation\sfund\splace\s*\n*)(.\n*)+(?=Change\s*[(]\s*[],\s*)

input :

Table 1
Student corperation fund place
Second Quarter 2019
Range 5.00% – 10.00% 5.00% – 10.75% 5.00% – 11.50% 5.50% – 11.50% 6.00% – 12.00%
Change (, , = )    
Average 1.30% 1.63% 2.35% 2.65% 3.00%
Change (Basis Points) – 33 – 105 – 135 – 170
Change (, , = )    

starting string

Table 1
Student corperation fund place

end string :

Change (

difficulties :
same as above explained - need to get the values as marked in bold but am getting full value

note : i tried to use the pattern like you shared but not able to get the output.

Thanks a lot @TimK

am able to get that now with this below pattern

(?<=Table\s1\s\nNATIONAL\sREGIONAL\sMALL\sMARKET\s*\n*)(.\n*)+?(?=Change\s*[(]\s*[],\s*)

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.