Jump to content

Find and replace first two characters of text problem


Organic

Recommended Posts

I have about 10,000 pieces of individual text items (some is text, some is mtext) containing numbers that each are similar to the format "88XXX.XXX" where X is other numbers. I want to remove the two leading characters ('88' in this case) off of all pieces of selected text. I tried to do this with find/replace however some strings contain numbers such as 88562.881" where find/replace with '88*' as the find parameter and nothing as the replace parameter will then make the text to be 562.1 when I need the text to be 562.881. Am I just using find/replace and wildcards wrongly or does anyone know of an alternative way I could make this work? Cheers.

Link to comment
Share on other sites

Is there a space in front of the 88? If so, include it in the find. If there is no space, um well I'm not sure either, yet. A space is a locatable character. If the number is the only thing on the text item without a leading space it won't work, but if there is you can use the space.

Edited by Dana W
Link to comment
Share on other sites

I suggest you check out this gem from Lee Mac

 

http://www.lee-mac.com/bfind.html

 

It will do just about anything you ask it to,

and as we (his long time benefactors/fan base) have come to expect, with Lee's brilliant lisps,

will save you an incredible amount of time and effort.

 

Thanks Lee! :beer:

Edited by Dadgad
Link to comment
Share on other sites

Is there a space in front of the 88? If so, include it in the find. If there is no space, um well I'm not sure either, yet. A space is a locatable character. If the number is the only thing on the text item without a leading space it won't work, but if there is you can use the space.

 

No space infront.

I suggest you check out this gem from Lee Mac

 

http://www.lee-mac.com/bfind.html

 

It will do just about anything you ask it to,

and as we (his long time benefactors/fan base) have come to expect, with Lee's brilliant lisps,

will save you an incredible amount of time and effort.

 

Thanks Lee! :beer:

 

Thanks, I found I already had that lisp installed :)

 

However it seems to do the same as the default AutoCad find/replace and I can't see any extra functionality that works for this specific case?

Link to comment
Share on other sites

How about '88***.' if you include the decimal point it is unlikely to find text with two decimal points ! you might want to run it a couple of times if you have to deal with larger or smaller numbers.

Link to comment
Share on other sites

How about '88***.' if you include the decimal point it is unlikely to find text with two decimal points ! you might want to run it a couple of times if you have to deal with larger or smaller numbers.

 

For the example piece of text "88125.881"

 

Find "88***." and replace with "" (i.e. nothing) gives the result "881"

 

Find "88***." and replace with "***.*" gives the result "***.*881". I.e. asterisks are actually added to the text.

 

It doesn't seem to work like the rename function unfortunately (where wildcards do work well).

Link to comment
Share on other sites

:reallymad: I keep going back to this, ridiculous, there is no way to get it to leave the wildcard sections as the original, when you do a replace.
Link to comment
Share on other sites

:reallymad: I keep going back to this, ridiculous, there is no way to get it to leave the wildcard sections as the original, when you do a replace.

 

I found/modified a lisp that sort of does what I want by removing the first character of the text items. Then just running the lisp a second time to remove the second character. Thread on that here: http://www.cadtutor.net/forum/showthread.php?91296-Basic-lisp-help-with-str-manipulation&p=625013#post625013

 

It does seem a bit ridiculous although I presumed it was more just me failing at using wildcards properly. http://forums.augi.com/showthread.php?155351-Using-wild-cards-in-both-find-and-replace[url=http://www.cadtutor.net/forum/showthread.php?91296-Basic-lisp-help-with-str-manipulation&p=625013#post625013][/url] explains the problem better than I do and is exactly the same as what I want to do; unfortunately no solution forthat one either.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...