Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8955573
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T14:35:33+00:00 2026-06-15T14:35:33+00:00

I am cleaning a dataset using Google Refine. I have one column with dates

  • 0

I am cleaning a dataset using Google Refine. I have one column with dates in the mm/dd/yyyy format. I want to create a new column in which mm/dd/yyyy is replaced by yyyy only.

I have tried

value.replace(/.+(\d\d\d\d)\*/, /$1/)

and what showed up was

Error: replace expects 3 strings, or 1 string, 1 regex, and 1 string

Why does this error show up? Thank you for helping a beginner!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T14:35:35+00:00Added an answer on June 15, 2026 at 2:35 pm

    If the values are just dates in that regular format, the easy solution is:

    value.split('/')[2]
    

    if you need to pluck the date out of the middle of a long string or just have a warped desire to mess with regex 🙂 then you can use

    value.replace(/([1-9]|0[1-9]|[12][0-9]|3[01])\D([1-9]|0[1-9]|1[012])\D(19[0-9][0-9]|20[0-9][0-9])/, "$3")
    

    BTW, there are lots of canned regexes on the web that you can just search for rather than recreating them yourself which is what I did here. I wouldn’t have made it anywhere near that complex/specific. You should adjust it to your needs, depending on how strict/liberal you want your matching.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have several large (30+ million lines) text databases which I am cleaning up
I'm cleaning up some legacy code and I have found methods which explicitly throw
I'm cleaning up CSS from a previous designer. The file is messy. One example
I'm using PRG for cleaning up my posts in MVC On the POST action
I run a DO in Stata cleaning my dataset and then call Python to
I have a project that isn't using USING anywhere with their ADO.NET code. I
R cleaning up a character string and converting it into a numeric I have
I'm cleaning some text from unwanted HTML tags (such as <script> ) by using
currently I'm cleaning up some code which creates a lot of php warnings. I've
I'm cleaning up all the errors in an old script and I'm getting one

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.