FranzB 0 Posted November 1, 2021 I need to extract a word from a text file, the word is defined like MyWord ( ......... . ); MyWord( .....) MyWord ; MyWord; Can I extract MyWord with one regex expression or do I need 2 spilt lines of code and compare ? list := TRegEx.Split(Input_Text, '(' ); Share this post Link to post
Fr0sT.Brutal 900 Posted November 1, 2021 (edited) From what you wrote, trivial Pos('MyWord', s) will do the job. Or you should define conditions more strictly. What could be inside brackets? What chars MyWord contains? You seem trying to extract function calls from a source file. Don't forget about comments if they're allowed Edited November 1, 2021 by Fr0sT.Brutal Share this post Link to post
FranzB 0 Posted November 1, 2021 (edited) MyWord is the string i want to extract, in the brackets come a list of numbers or strings LongList ( 1,2,3,4,5) Towns ( Paris, London, NY, Berlin) later I also need to extract the text between the brackets and need to port this code to delphi txt = "Town (my) simple test"; reg = /((.*))/; Ausgabe = txt.match(reg); Edited November 1, 2021 by FranzB Share this post Link to post