difurious
difurious

Reputation: 1542

Regex and Perforce commands

Is it possible to embed regex expressions into perforce commands?

So for an example I know the files name, but I only wish to get it from locations that end in a "v" or a "/". So something like:

p4 files //depot/.../LOCATION(v|/).../file.txt@label

However it doesn't appear the perforce likes that, so am I limited to doing something like:

p4 files //depot/.../file.txt@label | ack "/LOCATION(v|/)"

Or is there a way of including regex expressions in perforce commands? Or even an or expression for characters?

Further Example:

So a depot location could look like:

 1. //depot/folder1/folder2/LOCATIONv9/folder3/file.txt
 2. //depot/folder1/folder2/LOCATION/folder3/file.txt
 3. //depot/folder1/folder2/LOCATIONINVALID/folder3/file.txt

So from the examples above i'd be looking to just return locations 1 and 2, and ignore location 3.

Upvotes: 2

Views: 722

Answers (1)

Samwise
Samwise

Reputation: 71454

The p4 grep command supports regex expressions to search within file content, but regexes aren't a valid way to specify file paths or revisions in the general case.

You can use multiple recursive wildcards though, e.g.:

p4 files //depot/.../LOCATION.../file.txt@label

Upvotes: 2

Related Questions