Home Ask Login Register

Developers Planet

Your answer is one click away!

Tommy February 2016

How to delete n characters from string with regex

I try to use regex to delete the last n characters from a string. For example:

My input: azerty
My expected Output: azer

I want to have a regular expression that does this.


RAnders00 February 2016

You want to use this regular expression (try and view an explanation it online):


Post Status

Asked in February 2016
Viewed 3,069 times
Voted 12
Answered 1 times


Leave an answer

Quote of the day: live life