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 8137575
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T11:10:34+00:00 2026-06-06T11:10:34+00:00

Using mootools I have a regex like this: new RegExp(‘^([^\\D’+ separator +’]+)(\\d{2})’); In a

  • 0

Using mootools I have a regex like this:

new RegExp('^([^\\D'+ separator +']+)(\\d{2})');

In a string it inserts the char defined in separator after every 2 characters. I want it to insert only for the last two.

Example:

 String     Result
 123456     12.34.56  // what it does now
 123456     1234.56   // what it should do

I don’t have much experience with regex so any help or link to a decent tutorial is appreciated.

  • 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-06T11:10:36+00:00Added an answer on June 6, 2026 at 11:10 am

    Don’t use regex for this:

    var str = "123456".split('').reverse().join('');
    var x = str.substring(0,2) + '.' + str.substring(2);
    var final = x.split('').reverse().join('');
    
    console.log(final);
    

    Live DEMO

    Of course you can check if the string length is bigger than 2

    if (str.length > 2)
        // ...
    

    Or use string slice function:

    str ="123456";
    str.slice(0, -2) + "." + str.slice(-2);
    

    How does it work?
    I’ll break it into pieces:

    // Start at the beginning of the string grab all the chars 
    // and stop two chars before the end of the string
    str.slice(0, -2)
    
    // Start at two chars before the end of the string, take all the chars until  
    // the  end of the string.
    str.slice(-2);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have difficulties with using the this keyword in a MooTools (1.3) class. The
I have this website am designing, i tried using mootools 1.31 to animate some
I have written this Mootools example of a simple tool using canvas: http://jsfiddle.net/beingalex/MZTbW/11/ It
I have been using mootools for a year now. I need to use jquery
I have a jQuery code, but need it working by using Mootools: if (
I am using this sliding top panel using mootools (for orientation, the code is
using (var file_stream = File.Create(users.xml)) { var serializer = new XmlSerializer(typeof(PasswordManager)); serializer.Serialize(file_stream, this); file_stream.Close();
I noticed a lot of JQuery answers on this, but I'm using MooTools... I
I am using Mootools and I have the following div: <div class=total-title>12</div> I want
I have a problem with the Mootools get method and IE8. This is the

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.