Removing extra digits after decimal and leave only two decimal places

^(.*?\..?.?).*?$ your first match will leave the number with max 2 decimal digits. So find with ^(.*?\..?.?).*?$ and replace with \1 Input 27485.0375 75777.9125 10785.0125 13822.5 26700 41194.375 9375 4354.225 11564.475 12430.1 3246.4875 11596.3375 22466.0375 Output: 27485.03 75777.91 10785.01 13822.5 26700 41194.37 9375 4354.22 11564.47 12430.1 3246.48 11596.33 22466.03

November 12, 2018 · 1 min · Harshvardhan Malpani

Extracting names from given list of URLs (using regex)

let us extract name form the URL https://www.google.com/name?=rajiv paste the URL in the notepad and press crtl+f , and select ‘regular expressions ‘ from search mode now, enter the regex in the find tab to fetch names .*?\?=(\w+)$ Now, the selected name will be fetched form regex as (\1). it can work on numerous links like:- https://www.google.com/name?=rajiv/ http://www.example.com/asdas?=borde/id=? http://www.example.com/asdasd?=bordex http://www.example.com/name?=bordet http://www.example.com/asdasd?=border http://www.example.com/jsciloji?=bordeeeee http://www.example.com/name?=bordee http://www.example.com/name?=bordeeeeeee http://www.example.com/09328e?=bordeeee http://www.example.com/name?=borde http://www.example.com/lpaosd?=borde And only the part after first “?=” will be fetched

August 9, 2018 · 1 min · Harshvardhan Malpani

Commonly used regular expressions (regex) for developers in PHP

Commonly used regular expressions (regex) for developers in PHP Regex are used or can be used almost everywhere strings are involved. If you are dealing with text strings, you would often find patterns in them and you might be required to filter few of them based on some similarities and properties. For example: a currency or money is often written in this form – [Currency symbol] [Digits] ([.] [Digits])maybe Now, in order to filter any such things programmatically using a script, few of really helpful regular expressions are mentioned below: ...

May 15, 2016 · 3 min · Harshvardhan Malpani