RegEx to find "T-" literally
I've been trying to find some help on writing regular
expressions and haven't been very lucky. I'm trying to write a
regular expression to find "T-" to use with REFind.
Would the RegEx be \T- ?
You don't need to (and shouldn't) use a regex to find a
literal; just use
find().
Adam
Similar Messages
-
Is it viable to use regular expressions with Search "Specific Tag" (i.e.script) "With Attribute" (i.e. src) and "=" a regex string rather than an exact search term? The Find / Replace tool seems to prevent a simple wildcard find (i.e. "searchter* for searchterm) Any insight would be appreciated.
uneAaron wrote:
I'm trying to replace a script source value for all instances where the value contains the string "/bbcswebdav/xid-144702_1", where the string "xid-" is followed by a different numerical value in each instance.
The regex for finding that string is:
\/bbcswebdav\/xid\-[\d_]+
The numerical value contains an underscore, so the final section ( [\d_]+ ) uses a range that selects one or more numbers and/or underscores.
Perhaps as important as identifying what you want to find is specifying how you want to replace it. Regexes can have capturing groups that can be used in the Replace field to simplify matters. -
I am quit new to regular expressions.
In a code looking like
120813.33.45693.4225.34556.med.med.doub.l.1
or 120813.33.45111.778966.34556.def.med.doub.l.1
I have to test that after the 6th point there is effectively "med".
Can someone help in the construction of a Regex to find the text after the 6th point?
Thanks!Hi Jump_Over,
Always Great!!!!!!
I am trying to reply for this question using GREP. But I can't.
But you are awesome. Daily I learnt lot of new things from you.
Thanks always
Beginner -
[regex help]Find EXACT characters in a String.
Ok, i got this so far ...
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Testing2 {
public static void main(String[] args) {
Pattern p = Pattern.compile("[wati]");
String text = "water";
Matcher m = p.matcher(text);
if (m.find()) {
System.out.print("Found !");
}With that code i got a match, but i ONLY want to find a match if the String matches the EXACTS characters in the Pattern ...
in this case i got, 'w' 'a' 't' 'i', 'w' 'a' 't', are in water, but 'i' NOT, so i don't want to have a match !
i don't know how to acomplish this :(
hope you can help me, thanks in advance :DUsername7260 wrote:
Ok, i got this so far ...
import java.util.regex.Matcher;
import java.util.regex.Pattern;
public class Testing2 {
public static void main(String[] args) {
Pattern p = Pattern.compile("[wati]");
String text = "water";
Matcher m = p.matcher(text);
if (m.find()) {
System.out.print("Found !");
}With that code i got a match, but i ONLY want to find a match if the String matches the EXACTS characters in the Pattern ...
in this case i got, 'w' 'a' 't' 'i', 'w' 'a' 't', are in water, but 'i' NOT, so i don't want to have a match !
i don't know how to acomplish this :(AFAIK there's no syntax in regular expressions to accomplish this. Try turning your string into a character array, sorting it, and then do a simple comparison. -
Regex to exclude a literal substring
I am trying to match a set of strings using a regular expression, but I also want to exclude several literals.
For example, I want to match all strings starting with root_obj.item_type., except those that end in the literal string emitter.
To match is simple enough ... the pattern I would use would be "root_obj\\.item_type\\..*". However, this would match strings ending with "emitter". I have tried a negative zero width lookahead (though I am uncertain exactly what that means), "root_obj\\.item_type\\..*(?!emitter)", but this still matches the strings I am attempting to exclude.
I have looked on the web, but have not found an answer to this. Any suggestions?
� {�jverd wrote:
sharkura wrote:
I guess you are saying only match strings that have exactly zero instances of emitter at the end of the string.
I also thought of
str.matches( "root_obj\\.item_type\\..*[^e][^m][^m][^i][^t][^t][^e][^r]" ); but I didn't even test it because it looks so ugly.It's also incorrect.
You're saying after item_type.*, it has to have exactly 8 characters, and the first can't be e, and the second and third can't be m, fourth can't be i, etc.Ah, so, desu ka.
I tried cotton's first solution, and it still matches the strings to reject. I am going to go beat my head against a book or a google until I figure this out. Thanks for the help, peoples.
� {� -
Regex to find hidden fields in HTML page
Hi all,
I'm trying to extract all the hidden field in a particular form,
I am currently using this:
Pattern p1 = Pattern.compile("<INPUT(.*?)>");
which returns a multitude of input types is there any way I can just search for the hidden types, any input would be much appreciated, Thanks
I have tried Pattern p1 = Pattern.compile<INPUT TYPE="hidden"(.*?)>");
but java will not let me escape the quotes please help.Regex'ing html/xml forms is not a good idea unless you know that the forms were createdly in a very strict format. Trying to do it on generic forms means that you will spend a great deal of time creating very complicated regexes for patterns that actually seldom appear.
It is much better to use a parser and then look for values that way. -
Regex to find word starting with $ symbol.
Hi,
I want to find all the words in a JTextPane starting with "$" symbol followed by alphabets or digits.
Below is the code, which I have written
public void matchAllWords(String textPaneData) {
String regexStr = "\\b(\\$?(\\w+))\\b";
Pattern p = Pattern.compile(regexStr);
Matcher m = p.matcher(textPaneData);
while (m.find()) {
System.out.println(m.group());
}Suppose the text pane data is
hello $world 2$ $test_string $50.0 $5*5
I want the method to match the following words
$world
$test_string
$50.0
But the program is printing:
hello
world
2
test_string
50.0
5*5
Please help me, where am I going wrong.
Thanks in advance.
Regards,
Vaishakh
Edited by: Vaishakh on Sep 16, 2009 4:24 AMThanks, as u said http://www.catb.org/~esr/faqs/smart-questions.html#writewell
How To Ask Questions The Smart Way
Eric Steven Raymond
Rick Moen
Write in clear, grammatical, correctly-spelled language
We've found by experience that people who are careless and sloppy writers are usually also careless and sloppy at thinking and coding (often enough to bet on, anyway). Answering questions for careless and sloppy thinkers is not rewarding; we'd rather spend our time elsewhere.
So expressing your question clearly and well is important. If you can't be bothered to do that, we can't be bothered to pay attention. Spend the extra effort to polish your language. It doesn't have to be stiff or formal - in fact, hacker culture values informal, slangy and humorous language used with precision. But it has to be precise; there has to be some indication that you're thinking and paying attention.
Spell, punctuate, and capitalize correctly. Don't confuse "its" with "it's", "loose" with "lose", or "discrete" with "discreet". Don't TYPE IN ALL CAPS; this is read as shouting and considered rude. (All-smalls is only slightly less annoying, as it's difficult to read. Alan Cox can get away with it, but you can't.)
More generally, if you write like a semi-literate b o o b you will very likely be ignored. So don't use instant-messaging shortcuts. Spelling "you" as "u" makes you look like a semi-literate b o o b to save two entire keystrokes. -
Anyone know how to use a regex to find an attribute in a tag?
Does anyone know how to do the following using a regular
expression in dreamweaver?
If cellpadding="ANYNUMBER" is located anywhere in a table
tag, get rid of it? I can get it to work by searching for table
cellpadding="([0-9]+)" but it only works if nothing is in between
table and cellpadding. If it looks like table border="0"
cellpadding="1", it won't work because border is in the way.Since 'cellpadding' can only be used in a table tag, just
search for '
cellpadding="([0-9]+)" and replace it with ''.
Murray --- ICQ 71997575
Adobe Community Expert
(If you *MUST* email me, don't LAUGH when you do so!)
==================
http://www.dreamweavermx-templates.com
- Template Triage!
http://www.projectseven.com/go
- DW FAQs, Tutorials & Resources
http://www.dwfaq.com - DW FAQs,
Tutorials & Resources
http://www.macromedia.com/support/search/
- Macromedia (MM) Technotes
==================
"jm1275" <[email protected]> wrote in
message
news:e5hl20$ge8$[email protected]..
> Does anyone know how to do the following using a regular
expression in
> dreamweaver?
>
> If cellpadding="ANYNUMBER" is located anywhere in a
table tag, get rid of
> it?
> I can get it to work by searching for table
cellpadding="([0-9]+)" but it
> only
> works if nothing is in between table and cellpadding. If
it looks like
> table
> border="0" cellpadding="1", it won't work because border
is in the way.
> -
Regex - matching literal characters
Im trying to match the following pattern using regex:
The string begins with a literal '\' is followed by any number of letters and/or numbers and ends with '&0]'
e.g. '\07761739009B&0]'
Im trying to devise my pattern but Im not exactly sure how to work with matching literal characters, I was lead to believe a '//' would dictate that the character is literal but this doesnt work:
Pattern Serial = Pattern.compile("(\\/.*+\\&0])");Thanks in advance for any advice\ is an escape character both in Java string literals and in regex.
"\\" produces a String containing a single \ character. But for a literal \, regex needs \\. So "\\\\" produces a single string containing \\ which in regex becomes a single literal \.
Also, I don't think you need to escape &. And you might need to escape ] but I'm not sure--it might be okay bare if there was no preceding [. -
Help in finding a regex pattern
Dear all REGEX Gurus.
We have a comma separated string like this:
132, 143, "222, 144, abc", 227, 888, "222#55#ab"
As you might have guessed, this comes from excel when we save as CSV file, and when one of the columns in excel has the value 222,144,abc. So excel itself puts " at beginning and end.
Now we want to split it based on ',' like this:
132
143
222,144,abc
227
888
222#55#ab
So what we thought is to use a REGEX to find a pattern that has anything beginning with ", ending with ", and has a comma (,) in between. We'd replace that comma with a special character.
System seems to perform greedy search if i search like this ",".
I tried this:
"([^"]+)" -> this works that it gives me all values within quotes. But I want only those which have a comma in them.
So in above, i do not want 222#55#ab to come.
Tried various combinations, but not able to get it work.
Can someone advise please how to achieve it?
Thanks in adv.Hi,
I am in 4.6 version and dont have the facility to regex it for you.
Just wrote a sample code, if useful then use it.
DATA:lv_string(100) TYPE c.
DATA:lv_len TYPE i.
TYPES:BEGIN OF ty,
field(100) TYPE c,
END OF ty.
DATA:it TYPE TABLE OF ty.
FIELD-SYMBOLS:<fs> TYPE ty.
lv_string = '132, 143, "222, 144, abc", 227, 888, "222#55#ab"'.
CONDENSE lv_string NO-GAPS.
SPLIT lv_string AT '"' INTO TABLE it.
CLEAR lv_string.
LOOP AT it ASSIGNING <fs>.
IF <fs> IS INITIAL.
delete it index sy-tabix.
CONTINUE.
ENDIF.
lv_len = strlen( <fs> ) - 1.
IF ( <fs>+lv_len(1) CA '"' ) OR ( <fs>+lv_len(1) CA ',' ).
<fs>+lv_len(1) = ' '.
ENDIF.
IF ( <fs>+0(1) CA '"' ) OR ( <fs>+0(1) CA ',' ).
<fs>+0(1) = ' '.
ENDIF.
CONDENSE <fs>.
WRITE:/ <fs>.
ENDLOOP. -
Regex with xml for italicize or node creation
Okay
Guess it's a complex situation to explain.
I am working on the text content of xml documents again. made quite a lot of progress with some of my other regex requirements.
I am looking for a specific set of words to italicize say for example 'In Vitro'
String Regex = "In Vitro";
// here I get the text of a particular xml Node which is a text node
String paragraph = nl.item(i).getNodeValue();
//Value of paragraph before replace is "and lipids and In Vitro poorlysoluble(in water"
String replace = "<Italic>In Vitro<Italic/>";
String paragRepl = m.replaceFirst(replace);
//Value of pargRepl after regex replace is "and lipids,?;:!and <Italic>In Vitro<Italic/> poorlysoluble(in water"
//then I update the content of the node again
nl.item(i)..setNodeValue(paragRepl);
// save the xml documentthe italic tag is interpreted by our custom stylesheet to display "In Vitro" in italics, the reason it cannot do that is because the the character entities of the < and > have been put in the text content of the node i.e < and >. On closer examination of the text of the node after the document was saves, it appeared this way " <Italic>In Vitro<Italic/> ". For some reasom the greater than sign came out okay, but still no point, It didn't actually create a new node. I am not sure how you can automatically put tags around specific text you find in xml documents using regex, or If I have to create a new node at that point.
it's xml so these entities come into picture.
any help is greatly appreciated, in short I need to just add a set of tags to a particular regex I find in an xml document,
thanks in advance
Jeevanokay i am getting closer to the solution as there is an api call from another proprietary language that would do this
but as I loop through the xml document, it keep selecting the text "In Vitro" even after it has been italicized.
So I guess my next challenge is getting a regex which looks for "In Vitro" but not italicized
For regex so far I have seen case insensitive handling, I have seen for italics
basically if I I can get my hands on a regex for example
String regex = "In Vitro && Not Italic"
any help is appreciated
Jeevan -
10.9.2 - Finder crashes every 5 seconds!!!
I have a MacPro with 24GB of RAM, 6 core Intel Xeon CPU, 2012 tower.
After the OSX 10.9.2 upgrade I had issues with the display port output on my graphics card. I resolved that issue temporerilly by using DVI-D and HDMI for both my monitors.
Today, however, I have an even WORSE fault!
FINDER CRASHES LITERALLY EVERY 5 SECONDS.
Pardon my French but I am SERIOUSLY ****** OFF NOW.
Every Finder crash log says exactly the same thing:
EXC_BAD_ACCESS
At first I thought it may be faulty RAM, but I have tried every RAM stick in isolation and it changes nothing. I have also went back down to one monitor and, again, it changed NOTHING. I have no extensions installed; this is 100% RAW Finder.app
What can I do to fix this without having to reinstall OSX?
Thank You.I did not say reinstall the OS. I think your boot HDD is failing. Disk utility (in your applications/utility folder) can verify the smart status of the drive. You can access disk utility from your install discs, an install USB, or a bootable clone.
You need an alternative boot source (not time machine). The problem you face is the exact reason many of us make install USBs, have install DVDs, or bootable clones.
If you have none of these, at least try and boot into recovery (hold command R at the chime). If your HDD is bad this won't help but if it is a file structure error then maybe you can access disk utility this way. -
Hello,
How could this code be modified to ignore spaces:
find / -iname "foo"
What I mean is I know this code will find files containing foo and it will ignore capitals and surrounding characters. But it will not find a file containing +fo o+ or fo.o for example. Is there any way to achieve this?
Thank you,
Rickman find
Look for -regex
Or
find / -name "foo" -o -name "*fo[ .]o*" -
I need to write a program that extracts data from a website an inserts it into a oracle database. I use HTML or JTidy to pretty the html code of the site that I am going to extract. After prettying up the code us JTidy, I save file in a tempory directory. I then would like to use regex to find and extract data between two points and multiple lines.
example:
<table>
<!-- project title -->
<tr>
<td width="30%" align="right" valign="top">
<font size="-1">
<b>Project Title:</b>
</font>
</td>
<td width="70%" align="left" valign="top">
<font size="-1">
A Broad Spectrum Catalytic System for Removal of Toxic Organics from Water By Deep Oxidation
</font>
</td>
</tr>
first I would like to find the place holder<b>Project Title:</b> then extract the data between
<font size="-1">
A Broad Spectrum Catalytic System for Removal of Toxic Organics from Water By Deep Oxidation
</font>m and insert it into the oracle db
How do I do this? Once I am done with the webpage I can delete it from the temp directory. I have code that pretties the html code, and a java app that extracts data between two points. The only problem is that it has to have the same regex input. It will extract the data if the tags are identical like
<b>data between these tags<b>, works but
<b>data between these tags </b> does not. I then think I need to write a prepared or just statement to load the data into the db?
orozcomThat is not exactly what I need. This is a testing class that I have been playing with.
import java.util.regex.*;
public final class SplitTest
private static String REGEX = "<";
private static String INPUT = "<p>one two three four</p>five";
public static void main(String[] argv)
Pattern p = Pattern.compile(REGEX);
String[] items = p.split(INPUT);
System.out.println( "Length of array items: " + items.length);
System.out.println( "Item 0 of array items: " + items[0]);
System.out.println( "Item 1 of array items: " + items[1]);
System.out.println( "Item 2 of array items: " + items[2]);
System.out.println( "Item 3 of array items: " + items[3]);
//for(int i=0;i<items.length;i++)
for(int i=1;i<2;i++)
System.out.println(items);
items = null;
The out put is :
Length of array items: 3
Item 0 of array items:
Item 1 of array items: p>one two three four
Item 2 of array items: /p>five
why array item 0 empty? I would like to read between two html tags. I found some examples (sort of ) at http://www.regular-expressions.info/examples.html. It gave me the below information, but I still dont know how to implement.
<TAG[^>]*>(.*?)</TAG> matches the opening and closing pair of a specific HTML tag. Anything between the tags is captured into the first backreference. The question mark in the regex makes the star lazy, to make sure it stops before the first closing tag rather than before the last, like a greedy star would do. This regex will not properly match tags nested inside themselves, like in <TAG>one<TAG>two</TAG>one</TAG>.
any Ideas? -
Finder crashes every 2 seconds
hey there...
i've been having trouble with my computer tonight. my finder crashes literally every two seconds. if i try to open an application it crashes as soon as the finder does. i can't figure out anyway around this and seem to be trapped in an endless cycle of my finder opening and closing.
any help/suggestions would be greatly appreciated.
thanks in advance.
-ryan
12" powerbook G4 Mac OS X (10.4.3)-ryan,
Welcome to Apple Discussions.
Follow the procedure in Mac OS X: Starting up in Safe Mode.
Then find the com.apple.finder.plist in (yourusername)Library/Preferences Folder, move it to the Desktop and restart.
Let us know what happens.
;~)
Maybe you are looking for
-
How to use a KVM switch with my IMAC
Have a new IMAC and wanting to use my KVM switch - is there a way to use it? Thanks,
-
10000: PPPoE session recovery after reload
Hi. We have seen that there are a feature that recover the PPPoE sessions closed in one side and up in the other. This feature is called 'PPPoE Session Recovery After Reload '. In the feature navigator, we can see that this feature is available for 7
-
IF_EX_HRPAD00INFTY~IN_UPDATE not being called
Hi, I am trying to capture the employee information (InfoType 0002) during new hire action and send the information to an external system. IF_EX_HRPAD00INFTYIN_UPDATE not being called while maintaining InfoType 0002. However, IF_EX_HRPAD00INFTYIN_UPD
-
Hello experts, I have ETL running on an ODI server, and OBIEE running on another server (both Windows Server 2008 R2). I want to purge the OBIEE cache by calling a batch file after all the ETL loads are done. What would be the best way to accomplish
-
I just updated to ios 7. Upon rebooting after the update, I can't swipe the screen to unlock the ipad. I tried to hard reset but it still doesn't work.