Quote:
But it's not working.
Is not help us to understand what you want.
Quote:
I want to print the line number of the line which ends with backslash in python
Try
for Line in fp:
if (re.search('(\\)', Line)):
print(LineNumber)
LineNumber += 1
continue
Quote:
want to merge the line till Linenumber which contains '\' + 1
This is another problem.
you need to have this in a string instead of an array:
Hi
Hello \
Good Morning \
All
Programmers
Something like
test= "Hi\nHello \\\nGood Morning \\\nAll\nProgrammers"
then a RegEx that will match
"Hello \\\nGood Morning \\\nAll"
once you got the match in a single string, replace the "\\\n"
Just a few interesting links to help building and debugging RegEx.
Here is a link to RegEx documentation:
perlre - perldoc.perl.org[
^]
Here is links to tools to help build RegEx and debug them:
.NET Regex Tester - Regex Storm[
^]
Expresso Regular Expression Tool[
^]
RegExr: Learn, Build, & Test RegEx[
^]
Online regex tester and debugger: PHP, PCRE, Python, Golang and JavaScript[
^]
This one show you the RegEx as a nice graph which is really helpful to understand what is doing a RegEx:
Debuggex: Online visual regex tester. JavaScript, Python, and PCRE.[
^]
This site also show the Regex in a nice graph but can't test what match the RegEx:
Regexper[
^]