Jump to content
Sign in to follow this  
Teldin

StringRExExp help

Recommended Posts

Teldin

I need help changing the comma in "(?im)^(.+?)\w+\," to an "x".

Currently it matches the word in front of the first comma it sees, but I need it to get the word in front of an "x". However it can't be an x that is within the first word...

I've tried "(?im)^(.+?)\w+\x" , "(?im)^(.+?)\w+\(x)", "(?im)^(.+?)\w+\[x\]" , "(?im)^(.+?)\w+\[x]" but none work. RegEx is too confusing to me...

Thanks in advance.

Share this post


Link to post
Share on other sites
Xenobiologist

I need help changing the comma in "(?im)^(.+?)\w+\," to an "x".

Currently it matches the word in front of the first comma it sees, but I need it to get the word in front of an "x". However it can't be an x that is within the first word...

I've tried "(?im)^(.+?)\w+\x" , "(?im)^(.+?)\w+\(x)", "(?im)^(.+?)\w+\[x\]" , "(?im)^(.+?)\w+\[x]" but none work. RegEx is too confusing to me...

Thanks in advance.

HI,

sorry I connot follow you. Can you give an exmaple of a string before and after the Regexp?

Would be helpful!

So long,

Mega


Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
Teldin

Ok I think it maybe easier to change the pattern.

I have string that looks like: " name1 name2 weeklyincome ext age dept yearlygross"

The name can be either one or two words which is the problem.

The current expression of "(?im)^(.+?)\w+\," matches all the words (or word) I want as long as there is a comma in the income. If there is no comma, I won't get a name. While it's rare there is no comma, it does happen.

The name is always 6 whitespaces (to the right) from the end so how could I count all the words and backreference 6 spaces to get the first words?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×