Jump to content

Best practice for replacing string between specific characters


Recommended Posts

27 minutes ago, ViciousXUSMC said:

This is one time I feel RegEx is better than the string functions, is shorter, and does exactly what is needed without a complicated pattern.

czardas version works well, it does strip the pipes and have you add them back in the new text is the only thing I can see to be aware of.

I always feel that way but I am WEAK at regexp

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

Just now, Earthshine said:

I always feel that way but I am WEAK at regexp

unpopular opinion: the folk who crutch on regex suck with stringops and take unnecessary penalties

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

42 minutes ago, Earthshine said:

I always feel that way but I am WEAK at regexp

I am not strong at it, but have enough skill to make  use of it.  For unknown values it has really helped me automate a lot of things.

This is my best friend:

https://regex101.com/

Also lets you link to show examples:

https://regex101.com/r/M34RkR/1

 

Link to comment
Share on other sites

I consider myself a string-op master. i have always had to do it the hard way with every language. Basic, VB, C, etc.... but not C# cause all that stuff is built and tested and works great

that site is awesome. i have learnding to do as the stupid kid Sean on Jimmy Neutron would say

Edited by Earthshine

My resources are limited. You must ask the right questions

 

Link to comment
Share on other sites

  • 1 year later...

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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...