Move character to new position ?

A swapping-ground for Regular Expression syntax

Move character to new position ?

Postby new_mem » Sun May 27, 2018 5:20 pm

Hi all,

I am newber in BUK. :)

Can someone tell me move this character to new pos:
Exp:
A1234.BBBB.CCCC-DDDDDDDDD-EEEE
A2345.NNNNNN.CCCCCC-DDDDDDDDDDDDDDD-EEEE
Axxx.XXXXXXXXXXXX.XXXXX-XXXXX-EEEE
TO
BBBB.CCCC-A1234-DDDDDDDDD-EEEE
NNNNNN.CCCCCC-A2345-DDDDDDDDDDDDDDD-EEEE
XXXXXXXXXXXX.XXXXX-Axxx-XXXXX-EEEE

Thanks for solution
new_mem
 
Posts: 6
Joined: Sun May 27, 2018 5:12 pm

Re: Move character to new position ?

Postby Admin » Mon May 28, 2018 2:55 am

Hi, what is the pattern?
Admin
Site Admin
 
Posts: 2350
Joined: Tue Mar 08, 2005 8:39 pm

Re: Move character to new position ?

Postby new_mem » Mon May 28, 2018 4:34 am

Hi admin,

That is my folders project in home. And now in my new company, them have system deference.

In home:
CodeProject.Name.Descrip-Project-DescripP

Now i want to creat shorcut to change name folders shorcut (myHDD) in new system:

Name.Descrip-CodeProject-Project-DescripP

I newber in BUK. I don't understand combine select character in BUK. Pls tell me.

Thanks.
new_mem
 
Posts: 6
Joined: Sun May 27, 2018 5:12 pm

Re: Move character to new position ?

Postby therube » Mon May 28, 2018 4:03 pm

See if this gets you anywhere:

1:RegEx
Code: Select all
Match:  (\w+)\.(.*\.)(\w+-)(.*)
Replace:  \2\3\1-\4
therube
 
Posts: 1317
Joined: Mon Jan 18, 2016 6:23 pm

Re: Move character to new position ?

Postby new_mem » Wed May 30, 2018 1:41 pm

therube wrote:See if this gets you anywhere:

1:RegEx
Code: Select all
Match:  (\w+)\.(.*\.)(\w+-)(.*)
Replace:  \2\3\1-\4


Ok thank u for solution.

can u tell me your code then next time i don't need ask the question simple. ^_^
new_mem
 
Posts: 6
Joined: Sun May 27, 2018 5:12 pm

Re: Move character to new position ?

Postby therube » Wed May 30, 2018 3:59 pm

(I'm not very good with these regex things & sort of wing it)

find any number of "word characters" (\w+) followed by a (.)
[A1234]
then find any number of "word characters" (.*) followed by a (.)
(guess I would have used \w+ again?)
[BBBB.]
then find any number of "word characters" (\w+) followed by a (-)
[DDDDDDDDD-]
then everything else
[EEEE]
& with everything demarcated as needed
just rearrange things
therube
 
Posts: 1317
Joined: Mon Jan 18, 2016 6:23 pm

Re: Move character to new position ?

Postby new_mem » Wed May 30, 2018 4:14 pm

therube wrote:(I'm not very good with these regex things & sort of wing it)

find any number of "word characters" (\w+) followed by a (.)
[A1234]
then find any number of "word characters" (.*) followed by a (.)
(guess I would have used \w+ again?)
[BBBB.]
then find any number of "word characters" (\w+) followed by a (-)
[DDDDDDDDD-]
then everything else
[EEEE]
& with everything demarcated as needed
just rearrange things


Cool, thank u so much. :mrgreen:
new_mem
 
Posts: 6
Joined: Sun May 27, 2018 5:12 pm


Return to Regular Expressions