Coder Social home page Coder Social logo

RegEx string functions about asteria HOT 2 CLOSED

lhmouse avatar lhmouse commented on May 30, 2024
RegEx string functions

from asteria.

Comments (2)

lhmouse avatar lhmouse commented on May 30, 2024

|std.string.regex_find(text, pattern)

* Searches `text` for the first occurrence of the regular
  expression `pattern`.

* Returns an `array` of two `integer`s, the first of which
  specifies the subscript of the matching sequence and the second
  of which specifies its length. If `pattern` is not found, this
  function returns `null`.

* Throws an exception if `pattern` is not a valid regular
  expression.

std.string.regex_find(text, from, pattern)

* Searches `text` for the first occurrence of the regular
  expression `pattern`. The search operation is performed on the
  same subrange that would be returned by `slice(text, from)`.

* Returns an `array` of two `integer`s, the first of which
  specifies the subscript of the matching sequence and the second
  of which specifies its length. If `pattern` is not found, this
  function returns `null`.

* Throws an exception if `pattern` is not a valid regular
  expression.

std.string.regex_find(text, from, [length], pattern)

* Searches `text` for the first occurrence of the regular
  expression `pattern`. The search operation is performed on the
  same subrange that would be returned by
  `slice(text, from, length)`.

* Returns an `array` of two `integer`s, the first of which
  specifies the subscript of the matching sequence and the second
  of which specifies its length. If `pattern` is not found, this
  function returns `null`.

* Throws an exception if `pattern` is not a valid regular
  expression.

std.string.regex_match(text, pattern)

* Checks whether the regular expression `patterm` matches the
  entire sequence `text`.

* Returns an `array` of `array`s of optional `string`s. The first
  element contains a copy of `text`. All the other elements hold
  substrings that match positional capturing groups. If a group
  matches nothing, the corresponding element is `null`. The total
  number of elements equals the number of capturing groups plus
  one. If `text` does not match `pattern`, `null` is returned.

* Throws an exception if `pattern` is not a valid regular
  expression.

std.string.regex_match(text, from, pattern)

* Checks whether the regular expression `patterm` matches the
  subrange that would be returned by `slice(text, from)`.

* Returns an `array` of `array`s of optional `string`s. The first
  element contains a copy of `text`. All the other elements hold
  substrings that match positional capturing groups. If a group
  matches nothing, the corresponding element is `null`. The total
  number of elements equals the number of capturing groups plus
  one. If `text` does not match `pattern`, `null` is returned.

* Throws an exception if `pattern` is not a valid regular
  expression.

std.string.regex_match(text, from, [length], pattern)

* Checks whether the regular expression `patterm` matches the
  subrange that would be returned by `slice(text, from, length)`.

* Returns an `array` of `array`s of optional `string`s. The first
  element contains a copy of `text`. All the other elements hold
  substrings that match positional capturing groups. If a group
  matches nothing, the corresponding element is `null`. The total
  number of elements equals the number of capturing groups plus
  one. If `text` does not match `pattern`, `null` is returned.

* Throws an exception if `pattern` is not a valid regular
  expression.

std.string.regex_replace(text, pattern, replacement)

* Searches `text` and replaces all matches of the regular
  expression `pattern` with another regular expression
  `replacement`. This function returns a new `string` without
  modifying `text`.

* Returns the string with `pattern` replaced. If `text` does not
  contain `pattern`, it is returned intact.

* Throws an exception if either `pattern` or `replacement` is not
  a valid regular expression.

std.string.regex_replace(text, from, pattern, replacement)

* Searches `text` and replaces all matches of the regular
  expression `pattern` with another regular expression
  `replacement`. The search operation is performed on the same
  subrange that would be returned by `slice(text, from)`. This
  function returns a new `string` without modifying `text`.

* Returns the string with `pattern` replaced. If `text` does not
  contain `pattern`, it is returned intact.

* Throws an exception if either `pattern` or `replacement` is not
  a valid regular expression.

std.string.regex_replace(text, from, [length], pattern, replacement)

* Searches `text` and replaces all matches of the regular
  expression `pattern` with another regular expression
  `replacement`. The search operation is performed on the same
  subrange that would be returned by `slice(text, from, length)`.
  This function returns a new `string` without modifying `text`.

* Returns the string with `pattern` replaced. If `text` does not
  contain `pattern`, it is returned intact.

* Throws an exception if either `pattern` or `replacement` is not
  a valid regular expression.

from asteria.

lhmouse avatar lhmouse commented on May 30, 2024

Note the functions in e106afd are a bit different from these.

from asteria.

Related Issues (20)

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.