Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Translate .net regex to Perl regex

by roho (Canon)
on Sep 16, 2019 at 19:19 UTC ( #11106256=perlquestion: print w/replies, xml ) Need Help??

roho has asked for the wisdom of the Perl Monks concerning the following question:

I have been tasked at work to scan c# source code and extract c# method names. I have located some .net regexes on Stack Overflow that claim to extract c# method names. Unfortunately I cannot find any Perl regexes to extract c# method names. My question is, does anyone know of utilities that convert .net regexes to perl regexes? My searches have come up empty so far. TIA.

"It's not how hard you work, it's how much you get done."

Replies are listed 'Best First'.
Re: Translate .net regex to Perl regex
by Corion (Pope) on Sep 16, 2019 at 19:40 UTC

    Maybe you can show us some short testbed code where you try your regular expressions against some C# example code?

    Please also show us the .net regular expressions, and your effort to translate those to Perl. Most likely, .net regular expressions are basically the same as Perl regular expressions, except that .net likely uses strings where Perl has a special syntax for regular expressions. If that is the case, you can likely get away by simply replacing all double backslashes (\\) in the .net regular expression by a single backlash (\) for Perl.

Re: Translate .net regex to Perl regex ( Exuberant Ctags )
by Anonymous Monk on Sep 16, 2019 at 23:07 UTC

    Why not use Ctags?

    Unfortunately I cannot find any Perl regexes to extract c# method names.

    The full C#Sharp grammar is available at Grammar Zoo but its not easy to get to regexes from that...

Re: Translate .net regex to Perl regex
by roho (Canon) on Sep 20, 2019 at 11:19 UTC
    Thanks for the comments and suggestions. My basic question was about locating conversion utilities. I found one (RegexBuddy) that works fairly well. The only thing it has problems with is multiple .net regexes: @"..." + @"..." etc, but overall it does a decent job. Now it's time to wipe off my boots and move on to the next task. Thanks again. :)

    "It's not how hard you work, it's how much you get done."

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://11106256]
Approved by rjt
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (10)
As of 2019-12-10 13:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?