[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

Help with preg_match regular expression

Posted on 2009-05-04
4
Medium Priority
?
300 Views
Last Modified: 2012-08-13
Please check the regular expression and modify it if it needs tweaking.

ORIGINAL:

$array = array('marker1start', 4, 5, 6, 'marker1end')

preg_match('/^marker(\d+)start$/i', $value, $matches)


NEW (appended .txt to marker strings in $array):

$array = array('marker1start.txt', 4, 5, 6, 'marker1end.txt')

preg_match('/^marker(\d+)start$/i', $value, $matches)
0
Comment
Question by:fcqmax
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 35

Expert Comment

by:Terry Woods
ID: 24300850
Is this what you're looking for?

$array = array('marker1start.txt', 4, 5, 6, 'marker1end.txt')

preg_match('/^marker(\d+)start\.txt$/i', $value, $matches)
0
 

Author Comment

by:fcqmax
ID: 24300946
Sorry, my array strings were wrong, here is the correct version:

$array = array('text/marker1start.txt', 4, 5, 6, 'text/marker1end.txt')

preg_match('/^marker(\d+)start$/i', $value, $matches)
0
 
LVL 35

Accepted Solution

by:
Terry Woods earned 2000 total points
ID: 24300983
Try this then:

$array = array('text/marker1start.txt', 4, 5, 6, 'text/marker1end.txt')

preg_match('/^text\/marker(\d+)start\.txt$/i', $value, $matches)
0
 

Author Closing Comment

by:fcqmax
ID: 31577842
Great!
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
Suggested Courses

649 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