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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T00:26:41+00:00 2026-06-08T00:26:41+00:00

I am having trouble to create a regular expression that returns only a part

  • 0

I am having trouble to create a regular expression that returns only a part of a string.

Passing the following strings:

/path/of/the/file/1 - 2 - Lecture 1.2_ Max Bense (13_49).mp4
/path/of/the/file/1 - 3 - Lecture 1.3_ Michael Friedman (12_15).mp4
/path/of/the/file/2 - 1 - Lecture 2.1_ Paul Feyerabend (12_55).mp4
/path/of/the/file/2 - 2 - Lecture 2.2_ Alhazen (11_37).mp4
/path/of/the/file/3 - 2 - Lecture 3.2_ Study Case - Dominicus Gundissalinus (14_30).mp4 
/path/of/the/file/3 - 3 - Lecture 3.3_ Study Case - Carl Friedrich von Weizsacker (11_48).mp4

It should return only the following parts respectively:

Max Bense
Michael Friedman
Paul Feyerabend
Alhazen
Study Case - Dominicus Gundissalinus
Study Case - Carl Friedrich von Weizsacker
  • 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-06-08T00:26:43+00:00Added an answer on June 8, 2026 at 12:26 am

    Use PCRE and Positive Lookbehind

    If you have access to a regular expression engine that supports PCRE expressions, you can use positive lookbehind to get just the text you want from your MP3 listings. For example:

    pcregrep -o '(?<=_ )([^(]+)' /tmp/foo
    

    Use Sed

    If you don’t have a Perl-compatible grep, then you can use sed instead. It’s a lot less readable, but a lot more portable. For example:

    sed 's/.*_ \([^(]\+\).*/\1/' /tmp/foo
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm really having trouble with Javascript and regular expression. We've a log file generated
I'm having troubles to create a regular expression who checks if a file has
I'm having some trouble finding out how to create a custom transformer that can
I’m having a lot of trouble understanding how to create a module that will
I'm having some trouble with a regular expression for phone numbers. I am trying
I'm having trouble with the following code to create an NSDictionary of NSDictionaries. There
I'm having trouble calling a model's show path from within a create controller. I'm
I'm having trouble solving this problem: Create a function that given a character set
I am having trouble getting a connection string initialized to a text file when
I'm having trouble creating a sub that can create objects of a variable type

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.