New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

mlightner-enhanced_regexp

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mlightner-enhanced_regexp

  • 0.1.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Enhanced Regular Expressions

Author: mlightner@gmail.com

This package extends the functionality of Regexp objects by adding methods to create copies of them with modified options. It also allows for toggling of "inverted" status on a regexp object.

Example:

require 'rubygems' require 'enhanced_regexp' irb> exp = /test/i => /test/i irb> exp.case_sensitive? => true irb> exp2 = exp.without_case
=> /test/ irb> exp2.case_sensitive?
=> false irb> mlx = /test.*multiline/ => /test.*multiline/ irb> "test\n multiline".match(mlx) => nil irb> "test\n multiline".match(mlx.with_multiline) => #MatchData:0xb7c0c004 irb> "test\n multiline".match(mlx.with_multiline).inspect => "#MatchData:0xb7c0725c" irb> invx = /hello/i.invert!
=> /hello/i irb> invx.inverted? => true irb> "oh hello".match(invx) => false irb> "oh hai".match(invx)
=> true irb> invx.uninvert! => /hello/i irb> "oh hello".match(invx) => #MatchData:0xb7bedac8

NOTES:

  • With inversion, you can toggle it on any given regular expression without creating a new one.
  • When changing other option values, a new Regexp will ge generated and returned as the value of the call to regex.with_option (or without_option). This new regular expression will be identical to the original aside from the requested option change.

FAQs

Package last updated on 11 Aug 2014

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc