HPE GreenLake Administration
- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Perl - REGEXP Question.
Operating System - HP-UX
1833405
Members
3067
Online
110052
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
Discussions
Forums
Discussions
back
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
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
Go to solution
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
05-01-2004 12:34 PM
05-01-2004 12:34 PM
Im working on a search engine in pearl.
I looking for a REGEXP funktion using the string REALY found and not what I was looking for.
This is the because lower and upper case handling.
The found words will get highlighted, and if the user entered it lowercase but in the file its uppercase we like to highlighte it uppercase, which is not working in our code.
i.e.
if($Wort01 =~ /.+/) {$_ =~ s/$(Wort01)/$1<\/span>/g}
I looking for a REGEXP funktion using the string REALY found and not what I was looking for.
This is the because lower and upper case handling.
The found words will get highlighted, and if the user entered it lowercase but in the file its uppercase we like to highlighte it uppercase, which is not working in our code.
i.e.
if($Wort01 =~ /.+/) {$_ =~ s/$(Wort01)/$1<\/span>/g}
Solved! Go to Solution.
3 REPLIES 3
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2004 08:48 PM
05-01-2004 08:48 PM
Solution
$Wort01 and s{\b($Wort01)\b}{$1}/gi;
several remarks
1. $(Wort01) will not match what you expect, ($Wort01) might
2. use /i to ignore case
3. use s{}{} or any other brace type seperator when working with regex that uses / to increase readability
4. $Wort01 =~ /.+/ is about the most inefficient I've seen for testing truth. You might consider $Wort01 =~ m/\S/
Enjoy, Have FUN! H.Merijn
several remarks
1. $(Wort01) will not match what you expect, ($Wort01) might
2. use /i to ignore case
3. use s{}{} or any other brace type seperator when working with regex that uses / to increase readability
4. $Wort01 =~ /.+/ is about the most inefficient I've seen for testing truth. You might consider $Wort01 =~ m/\S/
Enjoy, Have FUN! H.Merijn
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-01-2004 08:50 PM
05-01-2004 08:50 PM
Re: Perl - REGEXP Question.
Oh, and forgot, since $_ is the default for many functions and operators, you'll increase readability IMHO, by using it like that, so
$_ =~ s{}{};
is the same as plain
s{}{};
Perl has already enough line noise as it is
Enjoy, Have FUN! H.Merijn. [ who just happens to love perl's line noise ]
$_ =~ s{}{};
is the same as plain
s{}{};
Perl has already enough line noise as it is
Enjoy, Have FUN! H.Merijn. [ who just happens to love perl's line noise ]
Enjoy, Have FUN! H.Merijn
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2004 07:11 AM
05-02-2004 07:11 AM
Re: Perl - REGEXP Question.
Thx procura,
My main fault was a simple typo
$(Wort01) instead to ($Wort01).
But Thanks tooo for the other tips, they could make my code much easier to read....
My main fault was a simple typo
$(Wort01) instead to ($Wort01).
But Thanks tooo for the other tips, they could make my code much easier to read....
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 2025 Hewlett Packard Enterprise Development LP