Use REGEXP_INSTR to find a text string with space(s) in it
I am trying to use REGEXP_INSTR to find a text string with space(s) in it.
(This is in a Function.)
Let's say ParmIn_Look_For has a value of 'black dog'. I want to see if
ParmIn_Search_This_String has 'black dog' anywhere in it. But it gives an error
Syntax error on command line.
If ParmIn_Look_For is just 'black' or 'dog' it works fine.
Is there some way to put single quotes/double quotes around ParmIn_Look_For so this will
look for 'black dog' ??
Also: If I want to use the option of ignoring white space, is the last parm
'ix' 'i,x' or what ?
SELECT
REGEXP_INSTR(ParmIn_Search_This_String,
'('||ParmIn_Look_For||')+', 1, 1, 0, 'i')
INTO Position_Found_In_String
FROM DUAL;
Thanks, Wayne
Maybe something like this ?
test@ORA10G>
test@ORA10G> with t as (
2 select 1 as num, 'this sentence has a black dog in it' as str from dual union all
3 select 2, 'this sentence does not' from dual union all
4 select 3, 'yet another dog that is black' from dual union all
5 select 4, 'yet another black dog' from dual union all
6 select 5, 'black dogs everywhere...' from dual union all
7 select 6, 'black dog running after me...' from dual union all
8 select 7, 'i saw a black dog' from dual)
9 --
10 select num, str
11 from t
12 where regexp_like(str,'black dog');
NUM STR
1 this sentence has a black dog in it
4 yet another black dog
5 black dogs everywhere...
6 black dog running after me...
7 i saw a black dog
5 rows selected.
test@ORA10G>
test@ORA10G>pratz
Also, 'x' ignores whitespace characters. Link to doc:
http://download.oracle.com/docs/cd/B19306_01/server.102/b14200/conditions007.htm#i1048942
Message was edited by:
pratz
Similar Messages
-
How Can I replace newScale Text Strings with Custom Values?
How Can I replace newScale Text Strings with Custom Values?
How can I replace newScale text strings with custom values?
All newScale text is customizable. Follow the procedure below to change the value of any text string that appears in RequestCenter online pages.
Procedure
1. Find out the String ID of the text string you would like to overwrite by turning on the String ID display:
a) Navigate to the RequestCenter.ear/config directory.
b) Open the newscale.properties file and add the following name-value pair at the end of the file:res.format=2
c) Save the file.
d) Repeat steps b and c for the RmiConfig.prop and RequestCenter.prop files.
e) Stop and restart the RequestCenter service.
f) Log in to RequestCenter and browse to the page that has the text you want to overwrite. In front of the text you will now see the String ID.
g) Note down the String ID's you want to change.
2. Navigate to the directory: /RequestCenter.ear/RequestCenter.war/WEB-INF/classes/com/newscale/bfw.
3. Create the following sub-directory: res/resources
4. Create the following empty text files in the directory you just created:
RequestCenter_0.properties
RequestCenter_1.properties
RequestCenter_2.properties
RequestCenter_3.properties
RequestCenter_4.properties
RequestCenter_5.properties
RequestCenter_6.properties
RequestCenter_7.properties
5. Add the custom text strings to the appropriate RequestCenter_<Number>.properties file in the following manner (name-value pair) StringID=YourCustomTextString
Example: The StringID for "Available Work" in ServiceManager is 699.
If you wanted to change "Available Work" to "General Inbox", you would add the following line to the RequestCenter_0.properties file
699=General Inbox
Strings are divided into the following files, based on their numeric ID:
Strings are divided into the following files, based on their numeric ID:
String ID File Name
0 to 999 -> RequestCenter_0.properties
1000 to 1999 -> RequestCenter_1.properties
2000 to 2999 -> RequestCenter_2.properties
3000 to 3999 -> RequestCenter_3.properties
4000 to 4999 -> RequestCenter_4.properties
5000 to 5999 -> RequestCenter_5.properties
6000 to 6999 -> RequestCenter_6.properties
7000 to 7999 -> RequestCenter_7.properties
6. Turn off the String ID display by removing (or commenting out) the line "res.format=2" from the newscale.properties, RequestCenter.prop and RmiConfig.prop files
7. Restart RequestCenter.
Your customized text should be displayed.I've recently come across this information and it was very helpful in changing some of the inline text.
However, one place that seemed out of reach with this method was the three main buttons on an "Order" page. Specifically the "Add & Review Order" button was confusing some of our users.
Through the use of JavaScript we were able to modify the label of this button. We placed JS in the footer.html file that changes the value of the butt -
Padding String with spaces -tried known methods but code not working!
I am trying to figure out an easy way to pad a string with spaces at the end. The way that definitely works is a for loop where string = string + " "; until string is the length that I need. However, for several dozen strings this is a lot of unnecessary overhead. I've done some research and tried a few different things - yet none of them seem to actually pad the string.
import org.apache.commons.lang.StringUtils;
public class Test
public static void main(String[] args)
String one = "1234";
//print string at current lenght
System.out.println(one+"*");
//try padding using String.format (in padRight method below)
one = padRight(one,(8-one.length()));
System.out.println(one+"*");
one="1234";
//try padding using StringUtils
String tmp = StringUtils.rightPad(one, (8-one.length()));
System.out.println(tmp+"*");
private static String padRight(String s, int n)
return String.format("%1$-" + n + "s", s);
}I've researched and these are the two most common methods people are suggesting. I am using java 1.5 so the String.format should work.. however, when I run it (I use JBuilder) the output is always "1234*".... after I try to pad it the output should be "1234 *" (with 4 spaces between the 4 and *) . Any suggestions is greatly appreciated! Thanks in advance.Wow, I completely botched that... uncle_alice, thank you for clearing that up for me.
pbrockway2 - thank you, I actually did peruse the Formatter documentation - I would never post without researching something first... but I must have read it with one eye shut because walked away with the impression that I needed to submit the difference. I obviously misunderstood the documentation.
Thanks! -
GREP 'find/change' by list script: find a text string containing different para styles
Hi
I'm don't write scripts but do 'enjoy' copying, pasting and changing existing code/txt files.
I have built a GREP find/change .txt that performs a large number of text edits/changes.
But I'm left with an issue where I have paragraphs of text (styled earlier in the .txt file) that I'm unable to identify using GREP the usual way. I need to identify text in a particular paragraph style, followed by text in another paragraph style.
Is it possible with GREP to create a search string to find: text styled with one paragraph style, ending with a paragraph return, and to include in that selection the following paragraph/s styled with another paragraph style?
MTIA Steveseb400 napisał(-a):
What do you mean by I would mark "changing" in "copying, pasting and changing"?
Hi Steve,
I mean I can see a way by modifying some existing code with "find...change" job
1. set criteria to findGrep
2. store findGrep() in an array
3. check each found object if next paragraph matches some new criteria
4. run changeGrep() if true
Jarek -
Cp4 AS3 - using Javascript to generate a text string
I'm a complete Javascript beginner, so please forgive me if this is a stupid question!
I need to generate a pseudo random text string. I'm using the unpatched version of Cp4, AS3, Internet Explorer 7
I've had a look at Captivate.Dev.com and the w3schools site to try to understand how to pass variables & basic javascript, and this is what I've come up with:
var objCP = document.Captivate;
function GenerateCode(){
var rngen = new Array(8);
var tgits = new Array(8);
var cdrtn="";
var lpdx=0;
var mulier=1;
for (lpdx=0;lpdx<=5;lpdx++){
rngen[lpdx]=(Math.floor(Math.random()*9)+1);
mlier=mulier*(rngen[lpdx]);
tgits[lpdx]=rngen[lpdx]+"";
cdrtn=cdrtn+tgits[lpdx];
rngen[6]=(mlier%17)%10;
rngen[7]=(mlier%13)%10;
for (lpdx=6;lpdx<=7;lpdx++)
tgits[lpdx]=rngen[lpdx]+"";
cdrtn=cdrtn+tgits[lpdx];
objCP.cpEISetValue('MyJavascriptVariable', cdrtn);
GenerateCode();
I've created a user variable called MyJavascriptVariable , put the code above in the On Slide Enter, Execute Javascript window on the first slide, and on the second a simple caption box showing the variable contents.
However, when I press F12 I get an orange playbar at the top of the window, and in the middle the preloader and the captionbox (without the return value) flickering. i.e. classic sign of wrong AS version.
If I change to AS2 the movie progresses ok, but the value the caption reports back for MyJavascriptVariable is blank.
I know my core code works correctly - if I use the w3school's tryit editor with the code after the function declaration up to the closing curly before the objcCP line, with an addeded document.write to show the variable it works fine.
It's clearly something to do with the way I'm declaring/passing the function or the way Cp runs the javascript. But what?
Any help greatfully appreciated!
ThanksHi Jon,
You are right... it works great on the W3Schools site. Although in Cp, you ran into quite an issue using the modulus operater (%). Looks like Cp needs the encoded version of this operator which is (%25). Also, if you're using Cp4, then when you go to set the caption, you want to use objCP.cpSetValue(); Cp5 uses cpEISetValue. I also try to use single quotes when working with strings.
Here's the updated code:
var objCP = document.Captivate;
function GenerateCode() {
var rngen = new Array(8);
var tgits = new Array(8);
var cdrtn='';
var lpdx = 0;
var mulier=1;
for (lpdx=0; lpdx<=5; lpdx++){
rngen[lpdx]=(Math.floor(Math.random()*9)+1);
mlier=mulier*(rngen[lpdx]);
tgits[lpdx]=rngen[lpdx]+'';
cdrtn=cdrtn+tgits[lpdx];
rngen[6]=(mlier %25 17) %25 10;
rngen[7]=(mlier %25 13) %25 10;
for (lpdx=6; lpdx<=7; lpdx++){
tgits[lpdx]=rngen[lpdx]+'';
cdrtn=cdrtn+tgits[lpdx];
objCP.cpSetValue('MyJavascriptVariable', cdrtn);
GenerateCode();
This looks like some really crazy math.
Let me know if this helps.
Jim Leichliter -
Using AppleScript to find specific text in mail message?
I'm new to scripting, and I'm a bit lost on this one...
Is there any way to use AppleScript to find a file name from within the body of a mail message so it can be used later in the script?
Specifically, I want to use AppleScript to "read" the content of a mail message and look for a paragraph that says "Filename: MyFileName" so I can set "MyFileName" as a variable. (There will always be a paragraph that begins with "Filename: " in this particular email message.)
This will part of a larger script that uses Fetch to download "MyFileName" from our FTP server.
Thanks in advance for any ideas - I'm struggling with this one.
Andy GillOk, red_menace above me had a shorter and more elegant solution to the question, I'm adding this just for another example.
To solve your problem I'd make a mail rule that looked for any messages with "Filename:" in them (along with whatever criteria you wanted, like sender, domain, etc). The mail rule would execute the Applescript. My assumption is that the "Filename:foobar" text could be anywhere in the email, not necessarily the first thing in a paragraph, so I had to parse it differently.
The results end up in a datalist, (theFilename {} ) that you can parse later to collect all filenames found in whatever messages were processed.
I realize this could be cleaner, hope it's not hard to follow, but I did it really fast. It works flawlessly for me, picking out the name of the file no matter where in the email it appears.
using terms from application "Mail"
on perform mail action with messages theSelectedMessages for rule theRule
repeat with aCounter from 1 to count theSelectedMessages
set theMessage to item aCounter of theSelectedMessages
set theContent to content of theMessage
set theWords to every word of theContent
set theFilename to {}
set tid to AppleScript's text item delimiters
set AppleScript's text item delimiters to ":"
repeat with thisLoop in theWords
try
if (text item 1 of thisLoop) is "Filename" then
set end of theFilename to (text item 2 of thisLoop)
-- rest of your logic goes here the display is just to show it finds the filename, take it out!
display dialog theFilename ¬
buttons {"OK"}
end if
end try
end repeat
set AppleScript's text item delimiters to tid
end repeat
end perform mail action with messages
end using terms from
Message was edited by: stephen.bradley Typos for the win! -
How can I find a text box with a specific word in it ?
Hi,
I have hundreds of settlement names on a map created with the text tool. How can I search on the name of one of them and find it on my map ?
I am with FH9 but the method would no doubt be backwards compatible from MX. If it isnt I would launch MX just for this exercise.
Would this also work if the word was part of a text box text ?
I have the luxury of it being the entire text box !
Cheers
EnvirographicsIf you have one large text box to search for the word, select it, then go to EDIT>FIND & REPLACE>TEXT...
Type in your word and click FIND NEXT button. If you have multiple occurances of the name, keep clicking the FIND NEXT button until the word hilites.
If you have scattered text boxes on your map, don't select any of them but still go through the EDIT>FIND & REPLACE>TEXT... routine I mentioned. FreeHand will look through all text boxes to find your word.
Oh yeah, this works the same in FreeHand 8 thru FHMX. -
How to find associated text frame with XML element?
Hello experts, I am new to InDesign CS SDK and have a question.
I am building an Extension to import an XML document into an InDesign template. As the content in XML can be unpredictable, in the Extension, I want to loop through all the XML elements and make sure it has associated text frames, and if it doesn't, I want to create a text frame and set the content to the text frame.
I think I figured out how to create a new text frame in page and set the content in the frame, but I am having difficulty finding an associated text frame for an XML element.
If anyone has a sample code finding a text frame for an XML element, I appriciate it. Or if anyone can tell me what document I need to look, it will be great too.
Thanks,Here's a code snipet with null checks removed:
UID MyClassName::GetFrameForXMLElement(IIDXMLElement* inXMLElement)
InterfacePtr< ITextModel > textModel( Utils< IXMLUtils >()->QueryTextModel( inXMLElement ) );
InterfacePtr< IFrameList > frameList( textModel->QueryFrameList() );
UID aFrameUID = frameList->GetNthFrameUID( 0 );
return aFrameUID; -
Use Keychain to find or store password with Safari
Hello Guys,
I wonder how I could use Keychain to find my forgotten password on hotmail with Keychain. Do we need to activate something? I'd really like to know.
At least, do you know how to set my Safari, so I can store my passwords?
Thanks!provided you actually ever stored the password in the keychain, open keychain Access, locate the keychain entry for hotmail, double-click on it and check the box to show password. you'll have to enter you keychain password at this point which is your login password by default.
-
Passing text parameter with spaces to oracle forms function
Hi,
I have a personalized link in R12.1.3 from OAF to a custom form, which is working fine:
Item Style = Link
Destination URI = form:PO:XXPO:STANDARD:XXXABC03:VENDOR_ID={@VendorID} QUERY_MODE=No
View Instance = SupplierVO
XXPO is the responsibility key, and PO the responsibility application
XXXABC03 is the function name
VENDOR_ID and QUERY_MODE are the form parameters
This link works as expected.
I have a problem passing a text parameter containing spaces. The Oracle Application Framework Developer's Guide
Release 12.1.3 states the following
Note: If you wish to send varchar2 parameter values that contain spaces, use \" to enclose the string value. For example, to pass in something of the form:
TXN_NUMBER=LT INVOICE 1
Use:
TXN_NUMBER=\"LT INVOICE 1\"
So my personalization becomes
Item Style = Link
Destination URI = form:PO:XXPO:STANDARD:XXXABC03:VENDOR_ID={@VendorID} VENDOR_NAME=\"{@VendorName}\" QUERY_MODE=No
View Instance = SupplierVO
But the problem is that the spaces in the vendor name parameter are replaced with %20 when the form opens, e.g. EXAMPLE%20SUPPLIER%20LTD instead of EXAMPLE SUPPLIER LTD
Has anybody got this type of personalization working? Thanks in advance, Ruth
Additional Note:
In real life I have created a workaround for this example. I just pass vendor_id and have modified the XXXABC03 form to derive vendor_name from vendor_id. But I now have another requirement where the parameter WILL have spaces.
In desperation I may add a function to the form to replace %20 with a space in text parameters.
But it would be nice if Oracle worked how it is explained in the manual......Hi,
I'm not sure if there is a built in function. Else, Javascript code would be necessary.
Using the technique in the link below will do.
http://www.java2s.com/Code/JavaScript/Form-Control/Jumptothenextfield.htm
Unfortunately, it doesn't seem like that tabIndex attribute is supported in ADF Faces. Link below.
ADF Faces setting the tab order between fields
They are suggestions to use the <h:inputText> component instead but not sure if that is supported and if other problem may occur.
Regards,
Chan Kelwin -
Breadcrumbs containing string with spaces - generating the anchor
so I have a website that contains a 'breadcrumbs' line that allows users to click on it, and take them back to the parent page
eg. "jewellery"
I simply suffix this string with ".cfm" to generate the anchor / filename
what's the best way to deal with strings containing spaces?
eg. "birthday cards"
As good practice I want to use a more compatiable filename that doesn't include spaces
eg. "birthday_cards.cfm"
is the REPLACE command ok to use ? or is preferrable to add an additonal field to the table, called "filename" and store the exact filename in there ?option 1
use quotes like href="http:\\....."
option 2
convert spaces to %2B -
How to concatenate a string with spaces
Dear experts,
I would like to concatenate a string with three spaces, for example,
CONCATENATE 'X' SPACE SPACE SPACE 'Y' INTO LV_RESULT.
However, the result I got from executing the above statement is not 'X Y' as I want, but rather 'XY'.
I did try
CONCATENATE 'X' '***' 'Y' INTO LV_RESULT.
REPLACE '***' with ' ' INTO LV_RESULT.
still doesn't work.
How can I write ABAP code to archive such a result?
Any idea would be appreciated.
Vitthavat A.dear Oliver Hütköper and koolspy,
I tried your solutions, and it works.
so i awarded points to you.
anyway, while trying the 'respecting blanks', i got an error:
"".", "IN BYTE MODE", "SEPARATED BY ..." or "IN CHARACTER MODE" expected"
not sure what it means. but it's ok. the problem has been solved.
thanks again. -
How do you pad a string w spaces using "Format into a string" w/o typing /s/s/s/s/s for say 5 spaces ?
Solved!
Go to Solution.
Attachments:
printed output.PNG 6 KB
wire diagram.PNG 11 KBHi Clint,
this way:
Best regards,
GerdW
CLAD, using 2009SP1 + LV2011SP1 + LV2014SP1 on WinXP+Win7+cRIO
Kudos are welcome -
How to use GREP to find one particular word with automatic hyphen?
I know I have in my text a word with automatic hyphen on the end of line, say Wo-rd.
How can I find it?
Thanks.I think you might do better to edit the hyphenation in the Dictionary.
One reason words hyphenate incorrectly is the wrong language has been applied. Both spell checking and hyphenation rules are governed by the language selected for the text, and language is a character-level attribute so that you can select inidvidual words and assign a different language to them if you like.
If that's the probelm here, you can look for the word using find/change (without worying about the hyphen) and change the language for all instances.
In either case you will be far better off fixing the problem on a global scale in the document than you will be finding a particular instance of that word at the end of a line. Any editing you do in the future may cause the problem to reappear somewhere else. -
Can I Pass String with Spaces in it To exec()
Hello All,
I am passing a Command in Runtime.exec() method, which is a String and contains a folder name(Folder---Name) which is having Spaces in it. For eg. c:/Folder/Folder(Spaces in between)Name/Data.java
My Problem is when i pass it to exec() it automatically gets converted to a Folder name with only one space
E.g c:/Folder/Folder(One Space in between)Name/Data.java,
Because of which my command is not able to find the Folder specifed.
I want the Original Path(c:/Folder/Folder(Spaces in between)Name/Data.java) to be passed and executed through
exec() so that the command runs successfully..........
Any help will be highly appreciable..
Thanks
Er.AtulWhen I make a simple array of String a, Try to run simple command like "change Directory"....
*try {*+
String[] a = {"cd atul", "cd poc"};+
Runtime runtime = Runtime.getRuntime();+
Process procedure = runtime.exec(a);+
+*} catch (IOException ex) {*+
Logger.getLogger(Testing.class.getName()).log(Level.SEVERE, null, ex);+
It Gives me this type of Exception............
Feb 20, 2009 5:13:36 PM Testing <init>
SEVERE: null
java.io.IOException: Cannot run program "cd atul": CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessBuilder.start(ProcessBuilder.java:459)
at java.lang.Runtime.exec(Runtime.java:593)
at java.lang.Runtime.exec(Runtime.java:466)
at Testing.<init>(Testing.java:26)
at Testing.main(Testing.java:36)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(ProcessImpl.java:81)
at java.lang.ProcessImpl.start(ProcessImpl.java:30)
at java.lang.ProcessBuilder.start(ProcessBuilder.java:452)
*... 4 more*
Maybe you are looking for
-
How can we contrrol the focus of an form Object from the Managed bean??
I am getting the following script error... Can't move the focus to the control because it is invisible or not enabled or of the type that does not accept the focus... I have a button whose action is mapped to a function in the Managed bean. In the ma
-
the email address connected to an old itunes account is no longer active. Can't access music i bought many years ago with out it and the old password.
-
No sound in videos problem!
Ever since I updated my desktop Mac with Mavericks I have been having ongoing issues with movies I have on my Mac. They were originally downloaded as (.avi) format however with the new Mavericks these videos go through a conversion process turning th
-
IMovie will not update after upgrading to iOS Yosemite
Have upgraded to Yosemite on iMac and Mac book, but iMovie will not update on either devices...it begins the long update and never seems to complete. On the iMac it says "no updates available" but the iMovie icon is crossed out on desktop. Says tha
-
Typical propagation distance of outdoor(1552E series) access point
Hello All, I need to propose an design for outdoor WAP deployment for an huge resort. As it is a complete open space area without any obstruction, I believe the signal can be propagated easily in over 35 meters radius across the access point. However