GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Reg Exp. Problem
Operating System - HP-UX
1848413
Members
1811
Online
104027
Solutions
Forums
Categories
Company
Local Language
back
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Blogs
Information
Community
Resources
Community Language
Language
Forums
Blogs
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2004 11:56 PM
06-29-2004 11:56 PM
Reg Exp. Problem
I need to write a regular expression which will match a string value for N's and T's but not a combination like NTNTNTN
This expression is what i wrote
[N*T*]$
Acceptable values of string
N
NNNNN.... any number of N's
T
TTTTTT ... any number of T's
N N N N there can be spaces inbetween
T T T T ...
but NOT something NTNTNTN or TNTNTNT
but the expression above is matching this combination tooo ...
Can anyone help me solve this?
This expression is what i wrote
[N*T*]$
Acceptable values of string
N
NNNNN.... any number of N's
T
TTTTTT ... any number of T's
N N N N there can be spaces inbetween
T T T T ...
but NOT something NTNTNTN or TNTNTNT
but the expression above is matching this combination tooo ...
Can anyone help me solve this?
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2004 12:08 AM
06-30-2004 12:08 AM
Re: Reg Exp. Problem
Solution I would use: {N+|T+}$
It depends on the program you use if this is a supported regex. And use + instead of *, because you don't want to match empty patterns.
It depends on the program you use if this is a supported regex. And use + instead of *, because you don't want to match empty patterns.
Every problem has at least one solution. Only some solutions are harder to find.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2004 12:11 AM
06-30-2004 12:11 AM
Re: Reg Exp. Problem
For egrep:
egrep 'N+$|T+$'
egrep 'N+$|T+$'
Every problem has at least one solution. Only some solutions are harder to find.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2004 12:15 AM
06-30-2004 12:15 AM
Re: Reg Exp. Problem
Sorry, missed one thing...
Should be:
egrep '^N+$|^T+$'
Should be:
egrep '^N+$|^T+$'
Every problem has at least one solution. Only some solutions are harder to find.
The opinions expressed above are the personal opinions of the authors, not of Hewlett Packard Enterprise. By using this site, you accept the Terms of Use and Rules of Participation.
Company
Events and news
Customer resources
© Copyright 2026 Hewlett Packard Enterprise Development LP