question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Large multi-line regex needed

See original GitHub issue
from lark import *

grammar = r"""
expr : 
    var 
    ANY
var :
    var_atom [script]
var_atom: /[a-zA-Z]|\\alpha|\\beta|\\gamma|\\delta|\\epsilon
           |\\zeta|\\eta|\\theta|\\vartheta|\\iota
           |\\kappa|\\lambda|\\mu|\\nu|\\xi|\\pi
           |\\rho|\\varrho|\\sigma|\\tau|\\upsilon
           |\\phi|\\varphi|\\chi|\\psi|\\omega
           |\\Gamma|\\Delta|\\Theta|\\Xi|\\Pi|\\Sigma
           |\\Upsilon|\\Phi|\\Psi|\\Omega/         
script: ANY
ANY: /./+


%import common.WS
%ignore WS
"""

   
if __name__ == '__main__':
   var_parser = Lark(grammar, start='expr')
   while True:
      s = input('s=')
      tree = var_parser.parse(s)
      print(tree.pretty())

Results in NL errors.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
erezshcommented, Oct 31, 2019

Just for the record, this should work:

var_atom: /[a-zA-Z]|\\alpha|\\beta|\\gamma|\\delta|\\epsilon/
           |/\\zeta|\\eta|\\theta|\\vartheta|\\iota/
0reactions
erezshcommented, Nov 1, 2019

Yes, that looks alright

Read more comments on GitHub >

github_iconTop Results From Across the Web

regex - How do I match any character across multiple lines in ...
The dot matches all except newlines (\r\n). So use \s\S, which will match ALL characters. Share.
Read more >
Multiline Regexp - EmacsWiki
Multi-line regular expressions would require Emacs to skip backwards multiple lines and see if any of the multi-line regular expression ...
Read more >
Regular Expression To Match Multiple Lines Of Text
I am using Visual Studio 17s find and replace component. Using a regular expression, I am trying to match and remove those description...
Read more >
Matching against multi-line strings with Java regular expressions
Tutorial and hints on matching regular expressions in Java against strings containing multiple lines.
Read more >
Multiline mode of anchors ^ $, flag "m"
And at the text start. Searching at line end $. The dollar sign $ behaves similarly. The regular expression \d$ finds the ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found