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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T21:07:28+00:00 2026-05-16T21:07:28+00:00

I am getting a string from Twitter into my Actionscript which is a unformatted

  • 0

I am getting a string from Twitter into my Actionscript which is a unformatted string. I want to be able to extract any links and or any @replies from the string, then display it in htmlText.

So far I have this

var txt:String = "This is just some text http://www.thisisawebsite.com and some more text via @sumTwitter";

var twitterText:String = txt.slice(txt.indexOf("@"),txt.indexOf(" ",txt.indexOf("@")));

var urlText:String = txt.slice(txt.indexOf("http"),txt.indexOf(" ",txt.indexOf("http")));

var newURL:String = ""+urlText+"";

var arr:Array = txt.split(urlText);

var newString:String = arr[0] + newURL + arr[1];

var txtField:TextField = new TextField();
txtField.width = 500;
txtField.htmlText = newString;
addChild(txtField);

This is fine for extracting links, which finish with a space. But what if, like the @sumTwitter, it finishes at the end of the string. And also what if there are multiple links or @’s, is the best way to put it in a while loop?

  • 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-16T21:07:29+00:00Added an answer on May 16, 2026 at 9:07 pm

    Regular expressions are the best option for what you want, I think.

    Check Grant Skinner’s RegExr. You could write and test your own RegExp there, which is very convenient. But you also can find a lot of useful ready-to-use regexps created by different users. Check out the “community” tab in the right panel. There, search by some meaningful keywords like “twitter” and “url” and you’ll get a good number of options.

    For example,

    Grab urls:

    http://regexr.com?2s5m4

    Capture twitter usernames:

    http://regexr.com?2s5m7

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

Sidebar

Related Questions

I am getting a string from HttpContext.Current.Request[key] which i then do split(',') if its
I am getting back a string[] from a 3rd party library. I want to
I am getting this string from server in response, which is actually in arabic
Im getting a string (simplified) from the backend that should be : { menu:
Hello I have an asp.net application where i am getting value from twitter and
How would I go about getting a string from a UITextField in the iPhone
i have a strange problem... I'm getting string-data from db: $siteDesc = strval( $configHandle->getConfigValue(
I am getting this JSON string from an ASP.Net webservice: {d:{Table:[{col1:123,col2:name,col3:name,col4:100,col5:\/Date(1153033200000)\/},{col1:123,col2:name,col3:name,col4:101,col5:\/Date(1153033200000)\/},{col1:123,col2:name,col3:name,col4:102,col5:\/Date(1153033200000)\/}]}} In my jQuery
I am getting a string hash like this: string content = a very long
I'm getting a FormatException: Input string was not in a correct format error that

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.