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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 31, 20262026-05-31T11:50:58+00:00 2026-05-31T11:50:58+00:00

Lets say we have this text The 85 kilos guy rant 10 miles and

  • 0

Lets say we have this text

The 85 kilos guy rant 10 miles and then we can se he is simply dummy text of the printing and typesetting industry and all of this in 2 hours

And we want to capture:

  1. 85 kilos

  2. 10 miles

  3. 2 hours

I was trying think of a functions that could retrieve som atributes (atributes known already, of corse)

Lets say we want to detect:

Atribute: [amount] [mesure]

And our mesures are:

[miles, seconds, hours, minutes, times, kilos]

So i was thinking to explode the text in blankspaces, check if word in array (of mesures) and if previous word is a number, then i have an Atribute 😀

(this is kind of pseudo/javascript code)

function get_mesure_attrs(txt){
     var text = txt.split(' ');
     for (i=1;i<=text.length;i++{    /*Note i begin with i=1 cause the first word would never be a mesure of a desired atribute */
         if(text[i] is in_array(mesures){
            if(is_number(text[i-1]){
                console.log('Atribute: '+text[i-1]+' '+text[i]);
            }
     }
}

I have no enough familarisation with related asociative arrays, so i was wondering if someone could give me a hint,

thanks a lot

  • 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-05-31T11:50:59+00:00Added an answer on May 31, 2026 at 11:50 am
    var str= "The 85 kilos guy rant 10 miles and then we can se he is simply dummy text of the printing and typesetting industry and all of this in 2 hours 1 kilo",
    measures = "mile|second|hour|minute|time|kilo";
    function getMeasureAttrs(txt) {
      var re = RegExp( "\\b(\\d+)\\s(("+ measures +")s?)","g" );
      var attrs = [];
      txt.replace( re, function  ( $, $1, $2 ) {
        attrs.push ([ $1, $2 ] );
      })
      return attrs;
    }
    console.log(  getMeasureAttrs( str ) ); // [["85", "kilos"], ["10", "miles"], ["2", "hours"],["1","kilo"]]
    

    for advance request

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

Sidebar

Related Questions

I am new to ruby on rails. Lets say i have this text.. Ashley
Lets say that I have this code $(document).ready(function() { $(#changeText).click(function() { $(#textBox).html(My<br><br><br>text<br><br><br>is<br><br><br>changed!); }); });
Lets say I have this: <object class=MyClass type=text/html data=/Whatever/1?renderpartial=1></object> <object class=MyClass type=text/html data=/Whatever/2?renderpartial=1></object> And,
Lets say i have this javascript code in an html pages <script type=text/javascript> $(document).ready(function(){
Lets say I have a large amount of (random) text. Within this text there
Lets say i have an application which has three text-fields, and i can type
Lets say you have this text Lorem ipsum dolor sit amet, consectetuer adipiscing elit.
Lets say I have a textarea with this text: first line some text. second
Lets say that i have this block of text public function __construct() { parent::__construct();
Lets say I have this: <script type=text/javascript> var p = document.getElementById('cls'); p.firstChild.nodeValue = 'Some

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.