Win an Ipad
  Developer   Documents   Regular Expressions

Regular Expressions

This article explains how Regular expressions work in Moscrif.

Regular Expressions

To help the users with matching, specifying and recognizing strings of text; such as particular characters, words, or patterns of characters; Mosrif supports RegExp as a native feature.

A regular expression, often called a pattern, is an expression that specifies a set of strings.

Example of the String.replace with regular expression, that will convert each Fahrenheit to Celsius number in the given string (s):

                var s = "25.5K";
// regEsp command, find whole or decimal number and split to two parameters
var regEsp = /(\d+)?(([.])?\d+)/g;
// convert kelvin to celsius
function k2c(str, g, z)
{
    // if number is decimal, z contains decimal part, otherwise it contains last character
    var number = g + z;     // return converted value
    return (number.toNumber() - 273.15) + "C";
}
// replace value
console<

 String   Regular Expressions   Function 
Write a Comment (0)
Subject
Please complete this mandatory field.
HTML Tags Not Allowed!
Comment
Please complete this mandatory field.