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

The Archive Base Latest Questions

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

All, I’m trying to extract all the URLS mentioned in an obfuscated JS file.

  • 0

All,

I’m trying to extract all the URLS mentioned in an obfuscated JS file. So far the script extracts only one URL. All the URLS are contained in one line due to obfuscation.
Here is the piece of code that I’m using for URL extraction:

  while( my $line = <$info>) {
            chomp ($line); #removing the unwanted new line character
            my ($uri)= $line =~ /$RE{URI}{HTTP}{-scheme=>'https?'}{-keep}/  ;
            $uri=~s/[,\']//g;
            print "$uri\n" if ($uri);
 }

How can I improve on this piece of code so that it correctly extracts all the URLS? This piece of code works nicely with normal JS files.

  • 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-31T12:58:35+00:00Added an answer on May 31, 2026 at 12:58 pm

    Try this. The /g at the end of the regex allows it to jump from match to match in successive invocations, keeping track of its position in the string as it goes along. See “Global matching” in “perldoc perlretut”, the Perl RegExpt Tutorial.

    The parenthesis I added around ($re) capture the result of the match and assign it to $1. See “Extracting matches” also in “perldoc perlretut”;

    while( my $line = <DATA>) {
                chomp ($line); #removing the unwanted new line character
                my $re = $RE{URI}{HTTP}{-scheme=>'https?'}{-keep};
                while ( $line =~ /($re)/g ){
                    my $uri = $1;
                    $uri=~s/[,\']//g;
                    print "$uri\n" if ($uri);
                }
     }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

All I am trying to do is take a standard range on an excel
All I want is to get the website URL. Not the URL as taken
All, I have some script tags that are not working in Wordpress. If I
I have a string like this: La Torre Eiffel paragonata all&#8217;Everest What PHP function
All, I am trying to create a table to receive user inputs (UGC). This
All I need is to create a file that contains a file names' list
I am trying to render a haml file in a javascript response like so:
I want use html5's new tag to play a wav file (currently only supported
All, In my Lex file we recognize some operators as Tokens some of this
All, I have a shell script on Mac OS X which uses the mdls

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.