Regex - is there any way to conditionally convert to a literal? -


simply put, want test presence of pattern in string , return "yes" if it's found, , "no" if not. said way, need (effectively) convert entire string either "yes" or "no" depending upon if pattern present or not.

so, example, if pattern (arbitrarily) "found", then:

example 1: this string not contain pattern

would converted to: no

example 2: i have found string!

would converted to: yes

i've been banging head against wall hour don't see how this. apologies if obvious , somehow missed it.

background:
i'm using tool called adbulkexport allows configure , download selected active directory data , export database.

my client uses specific notation in ad displayname field indicate if person contractor, parenthesised comment after person's name. e.g. "charlie lotridge (c)" means i'm contractor.

adbulkexport allows introduce regex conversion on value pulled down ad. so, using feature, want add new column called (something like) "iscontractor", have simple "yes"/"no" string value. fill need to, effectively, convert displayname field value yes or no depending on if parenthesized expression present.


Comments

Popular posts from this blog

asynchronous - C# WinSCP .NET assembly: How to upload multiple files asynchronously -

aws api gateway - SerializationException in posting new Records via Dynamodb Proxy Service in API -

asp.net - Problems sending emails from forum -