0

I need some help with javascript and regex.I want to remove some text in title.

I am new to regex and I tried this but it doesn't seems to work.

title.replace('/\d{4}\YEAR\d{1,2}\MONTH\d{1,2}\DATE/g', '');

Here is what I am trying to remove

2012YEAR2MONTH18DATE

1 Answer 1

1
title.replace(/\d{4}YEAR\d{1,2}MONTH\d{1,2}DATE/g, '');

Dont put the single quotes for the Regex

Sign up to request clarification or add additional context in comments.

1 Comment

Why \Y, \M and \D? Isn't title.replace(/\d{4}YEAR\d{1,2}MONTH\d{1,2}DATE/g, ''); enough?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.