BookmarkSubscribeRSS Feed
kohloffm
Calcite | Level 5

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.

7 REPLIES 7
Ksharp
Super User

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

Patrick
Opal | Level 21

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

kohloffm
Calcite | Level 5

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

TomKari
Onyx | Level 15

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

Patrick
Opal | Level 21

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"?

RW9
Diamond | Level 26 RW9
Diamond | Level 26

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.

Kurt_Bremser
Super User

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

sas-innovate-2024.png

Don't miss out on SAS Innovate - Register now for the FREE Livestream!

Can't make it to Vegas? No problem! Watch our general sessions LIVE or on-demand starting April 17th. Hear from SAS execs, best-selling author Adam Grant, Hot Ones host Sean Evans, top tech journalist Kara Swisher, AI expert Cassie Kozyrkov, and the mind-blowing dance crew iLuminate! Plus, get access to over 20 breakout sessions.

 

Register now!

How to connect to databases in SAS Viya

Need to connect to databases in SAS Viya? SAS’ David Ghan shows you two methods – via SAS/ACCESS LIBNAME and SAS Data Connector SASLIBS – in this video.

Find more tutorials on the SAS Users YouTube channel.

Discussion stats
  • 7 replies
  • 3985 views
  • 0 likes
  • 6 in conversation