# A little help needed with using numbers from an html file

**URL:** <https://forum.kirupa.com/t/a-little-help-needed-with-using-numbers-from-an-html-file/329290>\
**Category:** flash\
**Created:** [August 9, 2012, 5:51pm UTC](https://forum.kirupa.com/t/a-little-help-needed-with-using-numbers-from-an-html-file/329290 "2012-08-09T17:51:45Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![m2244](https://avatars.discourse-cdn.com/v4/letter/m/ac91a4/32.png) [@m2244](https://forum.kirupa.com/u/m2244)\
**Post date:** [August 9, 2012, 5:51pm UTC](https://forum.kirupa.com/t/a-little-help-needed-with-using-numbers-from-an-html-file/329290/1 "2012-08-09T17:51:45Z")

</div>

Hello,

I am trying to make an animation that gets its content from an html file. In the code below I am looking for an image tag in the html file. If it’s there I want to then look for the width attribute and grab the number from it. I can’t figure out a way to easily do it. I thought about looking for the closing double quote but what happens it the coder uses a single quote.

Can anyone get me back on track here?

Thanks for the look.

```auto

//If an image is called out in the html file, get its width and height
 if (loadedHTMLFile.search("<img ") > 0)
 {
  var imageStartIndex:int = loadedHTMLFile.indexOf("<img ");
  var imageURLtoLong:String = loadedHTMLFile.substr(loadedHTMLFile.indexOf("<img "));
  var imageEndIndex:int = imageURLtoLong.indexOf(">");
  var imageURL:String = loadedHTMLFile.substr(imageStartIndex, imageEndIndex +1);
  
  var widthStringStart:int = imageURL.indexOf(" width");
  var widthAttrtoLong:String = imageURL.substr(imageURL.indexOf(" width"));
 
  var regexNumber:RegExp=/[0-9]/g;
  var widthAttrStart:int = widthAttrtoLong.search(regexNumber);
  
  for(var i:int = 0; i < widthAttrtoLong.length; i++)
  {
   if(0 < int(widthAttrtoLong.substr(widthAttrStart, i)) < 1000)
   {
    //var numberCheck:int = widthAttrtoLong.substr(widthAttrStart, i);
    
    trace(widthAttrtoLong.substr(widthAttrStart, i));
   }
  }
 }

```
