4 Replies - 624 Views - Last Post: 12 May 2017 - 09:39 AM Rate Topic: -----

#1 castro  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 82
  • Joined: 12-November 05

Regular Exp to find wildcard characters and replace with empty string

Posted 12 May 2017 - 08:39 AM

Hello


I need help to replace this set of string/int using a simple regex.

what to change: 12333^ to 12333

I want to remove the caret ^.

This is what i have but it does not work for me.

This "^\d+\^" matches all this "12333^". You can test from here http://regexr.com/

Again with \^ will match only the caret as well. to replace the whole string "12333^" to "12333" doing this "\^//" is not working.

what can i do?

Thanks

Is This A Good Question/Topic? 0
  • +

Replies To: Regular Exp to find wildcard characters and replace with empty string

#2 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4136
  • View blog
  • Posts: 13,058
  • Joined: 08-June 10

Re: Regular Exp to find wildcard characters and replace with empty string

Posted 12 May 2017 - 08:54 AM

replace (preg_replace()) anything that is no a number (\D) with nothing ('').
Was This Post Helpful? 0
  • +
  • -

#3 castro  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 82
  • Joined: 12-November 05

Re: Regular Exp to find wildcard characters and replace with empty string

Posted 12 May 2017 - 09:28 AM

How can i do this in perl or excel?
I don't know if it is applicable with regards to the engine

This post has been edited by Dormilich: 12 May 2017 - 09:30 AM

Was This Post Helpful? 0
  • +
  • -

#4 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4136
  • View blog
  • Posts: 13,058
  • Joined: 08-June 10

Re: Regular Exp to find wildcard characters and replace with empty string

Posted 12 May 2017 - 09:30 AM

This is the PHP forum, if you want help with Perl or Excel, I can move it there.
Was This Post Helpful? 0
  • +
  • -

#5 castro  Icon User is offline

  • D.I.C Head

Reputation: 1
  • View blog
  • Posts: 82
  • Joined: 12-November 05

Re: Regular Exp to find wildcard characters and replace with empty string

Posted 12 May 2017 - 09:39 AM

View PostDormilich, on 12 May 2017 - 10:30 AM, said:

This is the PHP forum, if you want help with Perl or Excel, I can move it there.



I noticed I made a mistake and tried to open in the other language forum but it was closed due to duplicate.
Please move it to the other language forum instead.

Thank you
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1