Skip to content

Latest commit

 

History

History
12 lines (8 loc) · 422 Bytes

replace-everything-before-a-certain-point-using-regex.md

File metadata and controls

12 lines (8 loc) · 422 Bytes

Replace everything in a string before a certain point using regex

To remove/replace anything in a string to a certain point, use the following regex:

  var alphabet = "ABCDEFGHIJKLMNOPQRSTUVEXYZ";
  var replaced = alphabet.replace(/^.+M/,'');

This will replace everything before M and including M.

Stackoverflow