@skg_161125 - Since X is a variable here… you have to give as shown below…
So in your case,
System.Text.RegularExpressions.Regex.Replace(Input_String,"^(.*\n){"+x+"}","")
Hope this helps…
Note: If you want to use the shorter version , like regex.replace, regex.match please import system.text.regularexpressions in the import tab.