Find string between two characters -- regex?
So this seems like a regex type thing, but I'm still incredibly regex illeterate. If I have an offset in a string, I want to find all words separated by the space before and the space following that location.
For Example:
"This is a string of multiple characters"
If my cursor was between the o and the f in "of" i would want to return "string of multiple". I can then split this into an array of words using "\s" as a delimeter. I just need to get the substring shown.
CLA, LabVIEW Versions 2010-2013
Yamaeda wrote:
Or you split the string at the Offset, reverse the first half, look for the 2nd space in each (which can be a regex, similar to [^\s]*[^\s]*) then revese back and recombine.
/Y
Droppin' knowledge.
CLA, LabVIEW Versions 2010-2013
Similar Messages
-
How to Calculate the Space between two Characters in GDI + ?
I am Drawing the set of characters in Graphics, by Calculating the points using GraphicsPath for each Character. I Need to know how to calculate the distance should be given between the two characters?
I am using this code to generate points
PointF [] pnts;
var p=new GraphicsPath();
path.AddString("A","Arial",(int)FontStyle.Regular,50,new pointF(0f,0f),StringFormat.GenericDefault);
Matrix m=new Matric(1,0,0,1,0,0);
path.Flatten(m,1,0f);
pnts=path.pathpoints;
i am getting the points for all characters using the above code.
Now i am combining the two character Using the points generated by the above code. Eg "AB"
Help me to calculate the the character space should be given between two characters?
Thanks in Advance...Hi,
this link can assist you:>
Professional C# - Graphics with GDI+
Mark as answer or vote as helpful if you find it useful | Ammar Zaied [MCP] -
Finding Distance between two zipcodes with longtitude and latitude
Want to find distance between two zipcodes that have their latitude and longitude stored in a table.
The table is as follows
CREATE TABLE distance (zipcode VARCHAR2, LNG NUMBER, LAT NUMBER)
I couldn't come up with a calculation or understand the mathematical calculation on line.. Can you help me with some stored procedure that will do..?
ThanksThere is no logical complexity in your query besides knowing the basics of
http://en.wikipedia.org/wiki/Spherical_coordinates
Also, the table name "Distance" cannot be more confusing; what you have is essentially "PointsOnSphere".
select R*sqrt(
(sin(pi-p1.lng)*cos(p1.lat)-sin(pi-p2.lng)*cos(p2.lat))* (sin(pi-p1.lng)*cos(p1.lat)-sin(pi-p2.lng)*cos(p2.lat))
+
(sin(pi-p1.lng)*sin(p1.lat)-sin(pi-p2.lng)*sin(p2.lat))*
(sin(pi-p1.lng)*sin(p1.lat)-sin(pi-p2.lng)*sin(p2.lat))
+
(cos(pi-p1.lng)-cos(pi-p2.lng))*(cos(pi-p1.lng)-cos(pi-p2.lng))
from distance p1, distance p2
where R is the radius of Earth, and pi=3. Don't forget to convert angular degrees into radiants before you plug in them into the query above
Correction: This was euclidean distance sqrt((x1-x2)^2+(y1-y2)^2+(z1-z2)^2) between the points (x1,y1,z1) and (x2,y2,z2). Spherical distance is
sqrt(
(R*(colatitude1-colatitude2))^2+
(R*sin(colatitude1-colatitude2)*(longtitude1-longtitude2))^2
Message was edited by:
Vadim Tropashko -
Find gap between two dates from table
Hello All,
I want to find gap between two dates ,if there is no gap between two dates then it should return min(eff_dt) and max(end_dt) value
suppose below data in my item table
item_id eff_dt end_dt
10 20-jun-2012 25-jun-2012
10 26-jun-2012 28-jun-2012 There is no gap between two rows for item 10 then it should return rows like
item_id eff_dt end_dt
10 20-jun-2012 28-jun-2012
item_id eff_dt end_dt
12 20-jun-2012 25-jun-2012
12 27-jun-2012 28-jun-2012 There is gap between two rows for item 12 then it should return like
item_id eff_dt end_dt
12 20-jun-2012 25-jun-2012
12 27-jun-2012 28-jun-2012
I hv tried using below query but it giv null value for last row
SELECT item_id, eff_dt, end_dt, end_dt + 1 AS newd,
LEAD (eff_dt) OVER (PARTITION BY ctry_code, co_code, item_id ORDER BY ctry_code,
co_code, item_id) AS LEAD,
(CASE
WHEN (end_dt + 1) =
LEAD (eff_dt) OVER (PARTITION BY ctry_code, co_code, item_id ORDER BY ctry_code,
co_code, item_id, eff_dt)
THEN '1'
ELSE '2'
END
) AS new_num
FROM item
WHERE TRIM (item_id) = '802'
ORDER BY ctry_code, co_code, item_id, eff_dtI m using oracle 10g.
please any help is appreciate.
Thanks.Use start of group method:
with sample_table as (
select 10 item_id,date '2012-6-20' start_dt,date '2012-6-25' end_dt from dual union all
select 10,date '2012-6-26',date '2012-6-26' from dual
select item_id,
min(start_dt) start_dt,
max(end_dt) end_dt
from (
select item_id,
start_dt,
end_dt,
sum(start_of_group) over(partition by item_id order by start_dt) grp
from (
select item_id,
start_dt,
end_dt,
case lag(end_dt) over(partition by item_id order by start_dt)
when start_dt - 1 then 0
else 1
end start_of_group
from sample_table
group by item_id,
grp
order by item_id,
grp
ITEM_ID START_DT END_DT
10 20-JUN-12 26-JUN-12
SQL> SY. -
Awk - printing a value between two matching regex [SOLVED]
I'm trying to write a script to parse a single line output, but to then only display the value between two matching regex.
I have got it to only display the value between the matching regex, but then it carries on and displays the rest of the line. How do I tell it to stop once the matching value has been printed?
ARTIST=`awk '/Artist/,/Artist/ {gsub(/Artist/, Artist); print}' /home/sapphire/.foobar2000/track_info`
This produces 'Akira Yamaoka Title She Title Album Silent Hill 1 OST Album CurrentTime 0:03 CurrentTime TotalTime 2:01 TotalTime' rather then the desired 'Akira Yamaoka'.
So I guess I'm asking how one would go about terminating the above awk command? Thanks - I know, it'll be something simple - but I'm not experienced with scripting
Last edited by wyvern (2008-04-10 11:37:30)ibendiben wrote:Could you share the file you are extracting the data from?
No problem, and thank you for the help so far
This is what's written each time I update my playing track, no more, no less:
Artist Akira Yamaoka Artist Title Silent Hill Title Album Silent Hill 1 OST Album CurrentTime 0:04 CurrentTime TotalTime 2:51 TotalTime
Single line only, as the plugin won't break up the text into anything more than the one line -
How to find differene between two time fields??
Hi Experts,
I am trying to find difference between two time fields, I have created two formula variables by using replacement path for the two time fields, I have taken dimension key NUMBER, because of this time format is converting to numbers for example if the time is 13:20:10 then it is converting to 1,32,010 then it is calculating, I am getting wrong values.
Is there any options to find out the difference between two time fields.
Thanks in advance,
Venkat.use COPF_DETERMINE_DURATION. Its better you do it in data model itself.
If you have date and time seperately use command
use CONVERT TIMESTAMP command and
then use this function module to get the difference in
timestamp
CCU_TIMESTAMP_DIFFERENCE
us this in conjunction with the below function module
DAYS_BETWEEN_TWO_DATES
Edited by: Ananda Theerthan on Jan 21, 2010 7:18 AM -
How would I split a string between two strings?
Hi Guys,
I have a question hopefully you guys can help with..
I have a set of data similar to
sefsfesef<1111>Example<2222>desefsefsefefsefsef<1111>Example2<2222>sefsefsef
What I want to do is split my string between the <1111> and <2222> and get "Example" and "Example2" back... is this possible in Java? Possibly using regular expressions of sorts. I'm a little lost, any help would be much appreciated!
Thanks,
VasantHere is an example (parse.java) that will work provided that the content between <1111> and <2222> does not contain the < character.
import java.util.regex.*;
public class parse {
public static void main(String args[]) {
String teststring = "sefsfesef<1111>Example<2222>desefsefsefefsefsef<1111>Example2<2222>sefsefsef";
Pattern p = Pattern.compile("<1111>([^<]*)<2222>");
Matcher m = p.matcher(teststring);
while(m.find()) {
System.out.println(m.group(1));
}I'm sure some regex guru around here could solve this one in 3 characters or less, but that ain't me :) -
Bestway to find difference between two roles in quality and production
We have a process of collecting su53 dump and then analyze for missing authorization . However some time although everything works fine in quality , it fails in production . Hence I want to know a simple methodology to compare roles in quality and production to know difference ... Can anyone share best methodolgy being used in your setup ?
NPB(1)How to find the difference between two dates at Universe level and at report Level in IDT?
DaysBetween ([Sale Date];[Invoice Date]) returns 2 if [Sale Date] is 15 December 2001 and [Invoice Date] is 17 December 2001.
(2) How to change format of dates from YYYY/MM/DD to DD/MM/YYYY in IDT at prompt level ?
=FormatDate(ToDate(YOUR DARE OBJECT);"YYYY/MM/DD");"dd'/'MM'/'yyyy")
=To_Char (object name, required format)
Find the below link for more info.
http://scn.sap.com/community/semantic-layer/blog/2014/04/18/bi41-business-layer-enhancements--create-display-format
(3)What is VIEWS in IDT of data foundation layer when we right click? could u plz give one example where exactly we use VIEWS?
A custom data foundation view is a subset of the data foundation Master view. You can use views when editing a large data foundation, and interested in working with a subset of tables. You can define multiple custom views for the data foundation due to the complexity of the data warehouse.
Essentially, need created views for each individual star scheme (like Sales, Production, Finance, Accounting, etc.) plus a view for eachcomplex dimension structure (like Business Partner, Material, Customer, Plant etc.),
Find the below link for more info.
http://scn.sap.com/docs/DOC-54422
(4) How to represent & report my IDT data in dashboards? could u plz explain the steps?
Please find the below link: http://scn.sap.com/docs/DOC-27559 -
Find Differences between two tables at column level
Hi,
I have 2 tables one live table and the other History table..
If i have to find differences between live table and the latest version in the History table and also find which column got chaanged
How would i do that for a table which has many columns and i need each column for which the value has changed for a id
for ex:
Table 1 (LIve) Table 2 (History)
ID col1 col2 Version ID col1 col2 Version
1 ABC 123 V1 1 ABCD 123 v2
2 NBS 1234 V1 2 NBS 123 V2
Result set should be
Result Set:
ID col which changed
1 col1
2 col2
Because the values for that column had been changed
Except gives me all the differences not just the column level ..The dynamic version using schema views... :D
--Build a coulple OF testing tables to play with
CREATE TABLE dbo.Table1 (
ID INT IDENTITY(1,1) PRIMARY KEY,
Col1 INT,
Col2 INT,
Col3 INT
CREATE TABLE dbo.Table2 (
ID INT IDENTITY(1,1) PRIMARY KEY,
Col1 INT,
Col2 INT,
Col3 INT
INSERT dbo.Table1 (Col1,Col2,Col3) VALUES
(123,456,789),
(111,222,333),
(444,555,666),
(777,888,999),
(321,345,769),
(179,753,758),
(362,362,236),
(856,874,896),
(821,729,324)
INSERT dbo.Table2 (Col1,Col2,Col3) VALUES
(123,456,789),
(111,999,333), --col2 diff
(444,555,666),
(777,888,999),
(321,345,123), --col3 diff
(179,753,758),
(362,362,236),
(234,874,896), --col1 diff
(821,729,324)
And then the actual solution...
DECLARE
@t1 VARCHAR(10) = 'Table1',
@t2 VARCHAR(10) = 'Table2'
IF OBJECT_ID('tempdb..#temp') IS NOT NULL DROP TABLE #temp
SELECT
c.TABLE_SCHEMA,
c.TABLE_NAME,
c.COLUMN_NAME,
c.ORDINAL_POSITION,
CASE WHEN u.COLUMN_NAME IS NOT NULL THEN 1 ELSE 0 END AS PK
INTO #temp
FROM
INFORMATION_SCHEMA.COLUMNS c
JOIN INFORMATION_SCHEMA.TABLES t
ON c.TABLE_NAME = t.TABLE_NAME
AND c.TABLE_SCHEMA = t.TABLE_SCHEMA
LEFT JOIN INFORMATION_SCHEMA.KEY_COLUMN_USAGE u
ON c.COLUMN_NAME = u.COLUMN_NAME
AND c.TABLE_NAME = u.TABLE_NAME
AND c.TABLE_SCHEMA = u.TABLE_SCHEMA
AND OBJECTPROPERTY(OBJECT_ID(constraint_name), 'IsPrimaryKey') = 1
WHERE 1 = 1
AND t.TABLE_TYPE = 'BASE TABLE'
AND c.TABLE_NAME IN (@t1,@t2)
ORDER BY
c.TABLE_SCHEMA, c.TABLE_NAME, c.ORDINAL_POSITION
DECLARE @select VARCHAR(MAX)
SELECT @select = COALESCE(@select + ', ', '') + t.TABLE_SCHEMA + '.' + t.TABLE_NAME + '.' + t.COLUMN_NAME
FROM #temp AS t
ORDER BY t.TABLE_NAME, t.ORDINAL_POSITION
DECLARE @from VARCHAR(MAX)
SELECT @from = COALESCE(@from + ' FULL JOIN ', '') + t.TABLE_SCHEMA + '.' + t.TABLE_NAME
FROM #temp AS t
WHERE t.PK = 1
ORDER BY t.TABLE_NAME
DECLARE @on VARCHAR(MAX)
SELECT @on = COALESCE(@on + ' = ', '') + t.TABLE_SCHEMA + '.' + t.TABLE_NAME + '.' + t.COLUMN_NAME
FROM #temp AS t
WHERE t.PK = 1
ORDER BY t.TABLE_NAME, t.ORDINAL_POSITION
DECLARE @where VARCHAR(MAX)
SELECT @where = COALESCE(@where + CASE WHEN t.TABLE_NAME = @t1 THEN ' OR ' ELSE ' <> ' END, '') + t.TABLE_SCHEMA + '.' + t.TABLE_NAME + '.' + t.COLUMN_NAME
FROM #temp AS t
WHERE t.PK = 0
ORDER BY t.ORDINAL_POSITION, t.TABLE_NAME
DECLARE @sql VARCHAR(MAX) = '
SELECT ' + @select + '
FROM ' + @from + '
ON ' + @on + '
WHERE ' + @where
EXEC (@sql)
HTH,
Jason -
To find difference between two dates
Hi all,
I am new to this forum and oracle.
I want to get the difference between two dates. My query is as below...
sqlserver_utilities.datediff('YY', startdate,enddate)
I want the difference in year.
Please help me. It's really urgent.
Thanks in advance.
Regards,
InamSelect to_char(enddate,'YY') - to_char(startdate,'YY') fromPLEASE don't do that. There are so many things wrong with it...
for example:
1). Why are you subtracting character data types?
2). What if the start date is 1999 and the end date is 2000? Do you expect to get a difference of -1?
3). What if the start date is 1 Jan 2000 and the end date is 31 Dec 2000? Do you expect to get 0 instead of 1 or .997?
4). Why would you convert dates to something else when they are inherently subtractable.
5). There are obvious points in the OP's "specification" that are vague - the best thing (after telling them to search, of course since this has been answered a million times already) would be to try to clarify the spec.
John -
How to find differences between two columns
Hello I need the formula to spot differences between two columns and to write on a third one if the same name appear on the two columns.
For example:
rome berlin true
berlin moscow false
chicago toronto true
toronto chicago true
florence
Thanks
LorenzoYou should be able to use COUNTIF where the range is th first column and the condition is the word in the second column. If the result is greater than zero then the word is in both columns.
-
Find difference between two numbers (DBL)
Hello All,
Is there a function in labview other than subtraction function that can find the difference between the two given numbers?
Thanks,
Davidson
Solved!
Go to Solution.I think if he wanted to find absolute value he would have mentioned it.
And not asked about other function for taking difference.
Do you want to fight over this? When it is mentioned "DIFFERENCE" and not "ABSOLUTE" value.
Anyways..Will fight tomorrow. I am going home.
Best of luck
Gaurav k
CLD Certified !!!!!
Do not forget to Mark solution and to give Kudo if problem is solved. -
Find Discrepancies between two tables
Hello Everyone,
I have two tables payment and delegate, my payment table for some reason have more entries then in delegate table.
I can do something like , if the records in delegate table don't exsist....and they are in payments table
SELECT * FROM
Delegate d, Payment p
WHERE d.username != p.username
The usernames in payment table have to be in delegate table...So now if I want to look for discrepancies how should I find that out....
Tables Records :
Delegate :
Username Paid
User1 Y
User2 Y
User3 Y
User4 Y
User5 N
User6 N
Payment
username
User1
User2
User3
User4
User5
User6
So, basically I'm looking that which records are Paid = 'N' and somehow are in payments table:
In the above example result should be User5 and User6....
I'm using the old database, so please no fancy queries...even if it takes long time doesn't matter..
Please advise..
Thanks,
Harsimrat
Message was edited by:
HarsimratPerfect and if I want to do it other way around....Where there is an entry with Paid = 'y' in delegate table and is not in payments table. How can i find that out ??
Really appreciate.
Thanks,
Harsimrat -
Find angle between two kinect sensors
hi,
Consider a person is standing in front of kinect sensor A and to the side of the person another kinect sensor B is placed (i.e exactly 90 degree).How to find programmatically that the sensor B is located 90 degree to sensor A?
Any help is greatly appreciated
ThanksUse LIBICP to get a correspondence between the point clouds from the depth maps, or from body positions.
Iterative Closest Point -
Find difference between two vectors ?
Hi,
I have two vectors, the first contains:
v1.add("1");
v1.add("2");
the second:
v2.add("1");
Now I want to print out the difference between both.
Does anybody have en idea ?
Regards
MichaYep, that should definitely do it. I think the point ssav is trying to make is that to solve this problem we need to know your actual requirements. "the difference between" is too vague. Here are some things to think about:
- Is position important? That is, is a List containing 1 and 2 the same as a List containing 2 and 1 or different?
- If List A contains 1,2,4,5,6 and List B contains 1,2,3,4,5,6 what would you want to see?
- What if List A contains 1,2,3 and List B 1,2,2,3?
- What if List A contains 1,2,3 and Lits B 1,2,and a java.lang.NullPointerException?
You're probably starting to see that this is not as simple as you thought. Come back with more specific requirements and you may get better help.
Maybe you are looking for
-
I upgraded two of my Macs, a Mac Mini, A, and a MacBook Air, B, to OS X 10.9.4, using Software Update. After that, I could no longer ssh from A to B, but ssh from B to A worked fine. After some poking around for differences, I then noticed that in Ma
-
*Problem in Query Designer using Infoset
Hi, I'm having an Infoset that I'm creating a quey against. The query works fine with a few characteristics and keyfigures. But sometimes i got the following error messages when adding another characteristics or keyfigure: Operand data type varchar i
-
How to attach logos in smartforms using standard text??
logos in smartforms using standard text
-
"File Upload" stuck in fullscreen
I am using Windows 7 and Firefox 36.0.1. I opened a file upload and dragged it to the top of my screen to make it fullscreen (I was trying to find a file amongst many others). However, now any time I upload a file, the "File Upload" pop-up is fullscr
-
E71 won't display text messages
hello, i tried looking around for a solution for this but couldn't find one, i was wondering if anyone knows how to fix this problem, i cannot open my text messages in any way other than when it shows i have a new message in the homescreen and highli