#1
  1. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    10
    Rep Power
    0

    Return first number in Regular expression


    Hi,

    1.'/V/0/wowzahttpredir/vod/ep/mp4:/15649/iphone_M_R.mp4/playlist.m3u8?start=0'
    2./L/0/_15797/QualityLevels(1017789)/Fragments(video=73455380000)/WowzaSessions(572378284)/tcdnorig(91e3ddee7
    baec2a42b6c6a383a3e7c4981a8cf34fe140daada002f0b86c8dbcb).ismv
    3.'/L/0/15397/manifest(format=m3u8-aapl).m3u8'

    Returning first number
    1.How to get 15649 in first case and what regular expression I need to write here
    2.How to get 15797 in first case and what regular expression I need to write here
    3.How to get 15397 in first case and what regular expression I need to write here

    As I am new to regular expression,I do not know how to get first number in above cases.

    Could you please any one write regular expressions in above cases?

    is it possible to use one regular expression to get first number in above cases?

    Need urgent...

    Thanks in advance.
  2. #2
  3. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2012
    Posts
    832
    Rep Power
    496
    Try this:

    Perl Code:
    my $searched_number =  $1 if $line =~ /(\d+)/;


    This should work on all 3 cases that you gave, but you might want to describe the need more in details (tell us how to recognize for sure the number you want to pick and make sure you don't get another number in the line) for further cases.
  4. #3
  5. No Profile Picture
    Registered User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2013
    Posts
    10
    Rep Power
    0

    Regualar expression


    Thank you sir..

    But I want this kind of expression
    regexp_substr('/V/0/11467/The.Dark.Knight.Rises.2012.officialTrailer.ism/Manifest','\/([0-9]+)', 1,2)

    perl regular expressions are similar to vertica database sql that's I am posting here..

    I am testing for one case here
    select regexp_substr('/V/0/11467/The.Dark.Knight.Rises.2012.officialTrailer.ism/Manifest','\/([0-9]+)', 1,2) from dual

    the returned output is /11467..but I want only number...

    In the below case number is there after colon(i.e.
    '/V/0/wowzahttpredir/vod/ep/mp4:/15649/iphone_M_R.mp4/playlist.m3u8?start=0'

    how to get number and what type of expression need to write here..
  6. #4
  7. No Profile Picture
    Contributing User
    Devshed Novice (500 - 999 posts)

    Join Date
    Jun 2012
    Posts
    832
    Rep Power
    496
    Hmmm, did you realize this is a Perl forum?

    The syntax you are talking about has nothing to do, even remotely, with the Perl language.

IMN logo majestic logo threadwatch logo seochat tools logo