Help removing .txt in this regex.

28 views
Skip to first unread message

Louie Kilmer

unread,
Feb 11, 2013, 7:21:08 PM2/11/13
to re...@googlegroups.com
Hi, I'm fairly new to using regular expressions and would appreciate if anyone could help me remove the .txt extensions for this regex

I want to grab just what's in the curved brackets minus the .txt extension of course

/Type /Filespec
/F (filename_to_get.txt)

This is what I have so far: 

#\/Type \/Filespec[\n]\/F \((.*?)\)#

Which is giving me filename_to_get.txt

Ross Presser

unread,
Feb 21, 2013, 7:01:44 PM2/21/13
to re...@googlegroups.com
#\/Type \/Filespec[\n]\/F \((.*?)\.txt\)#

This would match ONLY filenames ending in .txt, and would leave off the .txt in what is grabbed. This might be what you want, of course.  If you wanted to grab ANY three letter extension:

#\/Type \/Filespec[\n]\/F \((.*?)\....\)#
Reply all
Reply to author
Forward
0 new messages