Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium


Regexp - need a tweak...

Posted on 2008-11-20
Medium Priority
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

bansidhar earned 2000 total points
ID: 23002941
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


Author Comment

ID: 23003001
Works perfect :-)

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

These days socially coordinated efforts have turned into a critical requirement for enterprises.
There are times when I have encountered the need to decompress a response from a PHP request. This is how it's done, but you must have control of the request and you can set the Accept-Encoding header.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
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 …
Suggested Courses

572 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