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

  • Home
  • SEARCH
  • 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 8683469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T22:03:14+00:00 2026-06-12T22:03:14+00:00

This is perhaps a tricky one. Using a regex, I want to select the

  • 0

This is perhaps a tricky one. Using a regex, I want to select the Arabic numbers (can be 1, 2 or 3 Arabic digits) between parentheses as well as the parentheses themselves here: http://jsfiddle.net/QL4Kr/.

<span>
    كهيعص ﴿١﴾
</span>
<span>
    وَإِلَيْهِ تُرْ‌جَعُونَ ﴿٢٤٥﴾
</span>​
jQuery(function () {    
    var oldHtml = jQuery('span').html();
    var newHtml = oldHtml.replace("","");
    jQuery('span').html(newHtml); });​
  • 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-12T22:03:15+00:00Added an answer on June 12, 2026 at 10:03 pm

    Here’s what I came up with:

    jQuery(function() {
    
        /* Arabic digits representation in Unicode
           See: http://stackoverflow.com/a/1676590/114029 */
        var myregex = /[\u0660-\u0669]+/;
    
        $('span').each(function(index) {
    
            var text = $(this).text();
    
            var matches = text.match(myregex);
    
            alert(index + ': ' + $(this).text());
    
            alert(matches);
    
        });
    
    });
    

    Here’s the jsFiddle to play with it: http://jsfiddle.net/leniel/YyAXP/


    Here’s the modified version that keeps only the numbers inside each <span>:

    jQuery(function() {
    
        var myregex = /[\u0660-\u0669]+/;
    
        $('span').each(function(index) {
    
            var text = $(this).text();
    
            $(this).text('');
    
            var matches = text.match(myregex);
    
            $(this).text(matches); 
    
        });
    
    });
    

    The jsFiddle: http://jsfiddle.net/leniel/YyAXP/1/


    To correct the misunderstanding, here’s a new version that does exactly what you want:

    jQuery(function() {
    
        var myregex = /[﴾\u0660-\u0669﴿]+/;
    
        $('span').each(function(index) {
    
            var text = $(this).text();
    
            $(this).text('');
    
            var matches = text.match(myregex);
    
            var content = text.replace(myregex, '');
    
            //alert(content);
            //alert(index + ': ' + $(this).text());
            //alert(matches);
    
            var newSpan = document.createElement('span');
    
            $(newSpan).text(matches);
    
            $(this).text(content);
    
            $(newSpan).prependTo($(this));
        });
    });
    

    The corresponding jsFiddle is here: http://jsfiddle.net/leniel/YyAXP/2/


    I hope this is your last requirement change! 🙂

    var myregex = /([\u0660-\u0669]+)/g;
    
    var parenthesis = /[﴾﴿]+/g;
    
    var text = $("#sentences");
    
    //alert(content);
    //var matches = $(text).text().match(myregex);
    //alert(text.html());
    
    text.html(function(i, oldHTML) {
    
        return oldHTML.replace(parenthesis, '').replace(myregex, '<span>$1</span>');
    });
    

    Here’s the jsFiddle: http://jsfiddle.net/leniel/G4SkV/4/

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

Sidebar

Related Questions

I was wondering something like this is possible. Perhaps using templates and trickery? The
How can one validate an XML file using an XSD in Java? We don't
this is somewhat tricky to figure out I think, perhaps I am missing something.
This is perhaps more of a discussion question, but I thought stackoverflow could be
Perhaps this is an effect of installing the new 4.5 beta, but my simulator
Perhaps this structure is not a good fit for Meteor, or maybe I'm thinking
Perhaps this question has been asked elsewhere, but I'm unable to find it. With
Perhaps this has something to do with it being the mainForm, but I'll ask
I have an ObjectDataSource (but perhaps this question is the same for all kinds
OK, this is perhaps stupidest question ever but bear with me.... How to make

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.