Regexp - need a tweak...

Posted on 2008-11-20
Last Modified: 2012-05-05
Hi !
I have a blobdata in a MS SQL server containing the rubbish below:
)ýýýýýýýýýýýýýýýýýýýýý\\trg4\eh_shared\input\78-268P02475923.tifýýýýýç ý¬ýýý*ý!ýÿý

I need to extract the string "78-268P02475923.tif" - and nothing else... so from the last \ until (and including) .tif

I need a PHP function that will return this - who can help me ??

RegEXP or anything goes :-)
Question by:trg_dk
    LVL 11

    Accepted Solution

    try the following. This will match files with 3 or 4 char extension like .tif or .tiff
    $a=' @¬ ýýýO_TRG_11ýýýý ýýýýýØ) ýýýýýý ý ý ý ýýý ýýýýýýýýý\\trg4\eh_shared\input\78-268P02475923.tifý ýýýýç ý ¬ ý ý ý*ý! ýÿý';
    if (preg_match_all('/\\\([a-zA-Z0-9-_]*\.[a-zA-Z0-9]{3,4})/',$a,$matches)){
    	echo $required_match;

    Open in new window

    LVL 2

    Author Comment

    Works perfect :-)

    Featured Post

    Highfive + Dolby Voice = No More Audio Complaints!

    Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

    Join & Write a Comment

    Both Easy and Powerful How easy is PHP? (  Very easy.  It has been described as "a programming language even my grandmother can use." How powerful is PHP?  http://en.wikiped…
    This article will explain how to display the first page of your Microsoft Word documents (e.g. .doc, .docx, etc...) as images in a web page programatically. I have scoured the web on a way to do this unsuccessfully. The goal is to produce something …
    Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    728 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    21 Experts available now in Live!

    Get 1:1 Help Now