Ruby regex for matching simpliest Ruby's regexes


I want to match regexes (at least the basic ones, not all their possible kinds... for now...) in a text of Ruby script.<br /> It's something like a... \/\^? oh my god... \$?\/[eimnosux]*

Maybe I need recursive regex here.


As I commented above, you'll need to parse Ruby to differentiate division slashes and regex delimiters. But for the simplest, SIMPLEST case without worrying about this, how about:

regex_match = %r{/(?:[^/\\]|\\.)+/[mgixo]*}

That is "A forward slash, followed by one or more things that either aren't a forward slash or a backslash, or are a backslash followed by something else, finally followed by a slash, and possibly some regex flags."


  • chrome does not render gif background image
  • How does Consumer.endOffsets work in Kafka?
  • Why do you have to add parentheses to + - operations when concatenating?
  • When using NuGet Pack is it possible to specify the package name without a nuspec file?
  • Assign array to variable
  • How to get rid of green warning line in VS2010 editor?
  • What is the connection between setVisibility and layout_weight in Linear Layout
  • Cannot read property “length” from undefined. (line 39, file “Code”)
  • Check if mouse\\keyboard is active using Batch or PowerShell
  • Azure Container Group IP Address disappeared
  • Duplicate ID error with updated Mojarra 2.1.27
  • Basic search in wordpress
  • Spring Security sec:authorize tag using Java Config
  • Insertion Sort in C#
  • Managing connections with Generic Repository pattern
  • Images tile on Google map in android
  • SVG animation not working in Chrome (using animateTransform in GWT)
  • Why does IntStream.range(0, 100000).parallel.foreach take longer then normal for loop
  • Android BottomNavigationView with Badge [closed]
  • Angular Library Modules export components, services and others from module
  • c++ plugin : Is it ok to pass polymorphic objects?
  • hadoop jar command points to local filesystem
  • No mapping data was returned from the server after installing ASP.NET and Web Tools 2012.2 Update
  • Django IN query as a string result - invalid literal for int() with base 10
  • How to use magento api with iOS app
  • Retrieving Application's DisplayName/UninstallString from Registry Using Powershell
  • Sum children values and save result to parent in n-ary tree in Javascript
  • date changes on export kendoGrid
  • SyntaxError: expected expression, got '.'
  • Slick: How can I combine a SQL LIKE statement with a SQL IN statement
  • How to get a time and Date Separately?
  • Excel Reverse Match
  • How to process remote XML files with XSLT
  • Modifying native query cannot have named parameter bindings?
  • Spring Boot fails to start
  • XEP-0166: Jingle protocol implementation for voice/video chat in iOS
  • Capture SIGFPE from SIMD instruction