Coder Social home page Coder Social logo

scottfirestone / regular-expression-knowledge-we-have-discovered Goto Github PK

View Code? Open in Web Editor NEW

This project forked from joshcheek/regular-expression-knowledge-we-have-discovered

0.0 1.0 0.0 2 KB

Regular expression... oh, go read the project name -.^

regular-expression-knowledge-we-have-discovered's Introduction

Knowledge we have discovered about regular expressions:

Methods

  • =~ Gives the index of the first match
  • [] return the first match
  • gsub FIND ME
  • split FIND ME
  • scan Returns an array of matches

Things that can be in a regular expression

  • /P/ A character, anywhere in the string
  • /PM/ Two characters next to each other
  • /M+/ One or more of its target
  • /M*/ Zero or more of its target
  • /./ match any character

Still unknown

  • [abc] A single character of: a, b, or c
  • [^abc] Any single character except: a, b, or c
  • [a-z] Any single character in the range a-z
  • [a-zA-Z] Any single character in the range a-z or A-Z
  • ^ Start of line
  • $ End of line
  • \A Start of string
  • \z End of string
  • \s Any whitespace character
  • \S Any non-whitespace character
  • \d Any digit
  • \D Any non-digit
  • \w Any word character (letter, number, underscore)
  • \W Any non-word character
  • \b Any word boundary
  • (...) Capture everything enclosed
  • (a|b) a or b
  • a? Zero or one of a
  • a* Zero or more of a
  • a+ One or more of a
  • a{3} Exactly 3 of a
  • a{3,} 3 or more of a
  • a{3,6} Between 3 and 6 of a

Open questions:

  • does case matter?
  • can we get rid of the plus in scan?

END $ curl -i google.com HTTP/1.1 301 Moved Permanently Location: http://www.google.com/ Content-Type: text/html; charset=UTF-8 Date: Thu, 07 Jan 2016 16:49:09 GMT Expires: Sat, 06 Feb 2016 16:49:09 GMT Cache-Control: public, max-age=2592000 Server: gws Content-Length: 219 X-XSS-Protection: 1; mode=block X-Frame-Options: SAMEORIGIN

<TITLE>301 Moved</TITLE>

301 Moved

The document has moved here.

regular-expression-knowledge-we-have-discovered's People

Contributors

joshcheek avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.