Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Help with GREP search

Explorer ,
Mar 25, 2014 Mar 25, 2014

I'm trying to change 01, 02, 03, up to 09 and change to the digit without the 0 (zero).

Thanks in advance,

Geoff

TOPICS
Scripting
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 25, 2014 Mar 25, 2014

I don't understand. Specifically...? Thank you to give us samples?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 25, 2014 Mar 25, 2014

Sorry, yes, I have class information that has dates, times and hours.  I want to change May 04 to May 4, May 07 to May 7 and so on. Just need to delete the zero in the dates while keeping the zero's in times, e.g. 10:30 p.m.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 25, 2014 Mar 25, 2014

So:

Search: (January|February|March|April|May|June|July|August|September|October|November|December)(\s0)

Replace: $1~S

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 26, 2014 Mar 26, 2014

Thank you Obi-wan.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 26, 2014 Mar 26, 2014

I understand the search, can you explain what $1~S is saying?

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Mar 26, 2014 Mar 26, 2014

Hi,

When we make a regex (grep search/replace), we often use code between (). Grep calls this "sous-expression marquante" (in french). If we write two "sous-expressions marquantes" as: (January)(\s0), in the replace input box, $1 reproduce "January", the first instance between (), (any space + zero) can be reproduced by $2. So if I finally choose "$1~S, that means: I replace (January) by: January (the () are forgotten) and ~S is the grep syntax of an nonbreaking space. (\s0), so (any space + zero), is not taken into account and finally non treated.

So, if I search: "January 0", when I find it, I replace it by: "January " (here, the space is a nonbreaking space (better for what you want!).

I suggest you to read all what you can find on Grep. With JavaScript and imagination, you have the 3 more important tools to work fine! 

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Mar 26, 2014 Mar 26, 2014

ok, yes, thanks again, that's what I thought, just wanted to be sure I it understood correctly.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Mar 28, 2014 Mar 28, 2014
LATEST

@GeofferyH use the following expression:

Find: (0{1})([1,2,3,9])

change: $2

print2.jpg

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines