SAS Data Integration Studio, DataFlux Data Management Studio, SAS/ACCESS, SAS Data Loader for Hadoop and others

Using Regex to find superscript

Reply
New Contributor
Posts: 2

Using Regex to find superscript

Can you recommend Regex to find superscripting in data?

For example, I need to find occurrences of ordinals using the superscripted st, nd, rd, th.

Super User
Posts: 9,671

Re: Using Regex to find superscript

What are you looking for ? What does your data look like .Better make an example to explain your question .

\d+st

\d+nd

\d+rd

\d+th




Xia Keshan

Respected Advisor
Posts: 3,887

Re: Using Regex to find superscript

Totally agree with : Provide sample data and the expected result.

New Contributor
Posts: 2

Re: Using Regex to find superscript

In the example below I list some products with descriptions containing superscripted ordinals.  I want to find any product description that has a raised st, nd, rd or th.  I do not need to find products that don't have the raised lettering, such as in the examples 1st, 2nd, 3rd or 4th.Superscript Example.png

PROC Star
Posts: 1,089

Re: Using Regex to find superscript

I don't think so. I believe that the superscripted letters are just regular letters with a different font, and I can't see anything in REGEX documentation that deals with fonts.

I'll be interested to see if a REGEX expert can provide better insight.

Tom

Respected Advisor
Posts: 3,887

Re: Using Regex to find superscript

Please provide some actual sample data as close to your real data as possible (eg. as an attachment) and not only a screen shot. If these are actual superscripts then I would expect that this information must be stored somewhere in the string (so when looking at the actual hex values used) - and if this is the case then we can look for such hex values to identify your superscript stuff. But in order to figure this out we need actual data from you.

Looking at your screenshot: Would it also be possible to simply search for "1st", "2nd", "3rd", "<any other single digit or more than one digit>th"?

Super User
Super User
Posts: 7,392

Re: Using Regex to find superscript

I agree with you Patrick.  If its an RTF destination then the actual RTF code should be present.  However PDF for instance may be more difficult.

Super User
Posts: 6,928

Re: Using Regex to find superscript

SAS knows of no superscription in it's data, character variables are just strings of bytes.

Any superscription that you see comes from output formatting, not from the data.

Can you show the SAS code that produced this: https://communities.sas.com/servlet/JiveServlet/showImage/2-262847-9589/Superscript+Example.png

---------------------------------------------------------------------------------------------
Maxims of Maximally Efficient SAS Programmers
Ask a Question
Discussion stats
  • 7 replies
  • 647 views
  • 0 likes
  • 6 in conversation