It might be simpler not to use a regular expression. Instead use this --


Format(Val(theNumberString), "0.0")

This would truncate 0.1005 to 0.1.

If you want to round the numbers, you could do


Format(Round(10*Val(theNumberString))/10, "0.0")

Charles Yeomans

On Oct 4, 2006, at 3:44 PM, [EMAIL PROTECTED] wrote:

Hi,

I have some code that takes the first column of a file and looks at the num bers, and then trims it if you will to a smaller amout. These are time
decimal numbers.


Full unedited would look like this:
0
0.01
0.02
0.03
0.04
0.05
0.06
0.07
0.08
0.09
0.1
0.11
0.12
0.13
0.14
0.15
0.16
0.17
0.18
0.19
0.2
0.21
0.22
0.23
0.24
0.25
0.26
0.27
0.28
0.29
0.3
0.31
0.32
0.33
0.34
0.35
0.36
0.37
0.38
0.39
0.4
0.41
0.42
0.43
0.44
0.45
0.46
0.47
0.48
0.49
0.5
0.51
0.52
0.53
0.54
0.55
0.56
0.57
0.58
0.59
0.6
0.61
0.62
0.63
0.64
0.65
0.66
0.67
0.68
0.69
0.7
0.71
0.72
0.73
0.74
0.75
0.76
0.77
0.78
0.79
0.8
0.81
0.82
0.83
0.84
0.85
0.86
0.87
0.88
0.89
0.9
0.91
0.92
0.93
0.94
0.95
0.96
0.97
0.98
0.99
1

A trimmed down version would look like this:
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1


So basically I am taking 100 samples a second to 10 samples a second.

Heres my Regex code that does this:



data="(\d*(.[1-9])?|\.[1-9])"
r.Options.TreatTargetAsOneLine=False
r.Options.DotMatchAll=False
r.Options.Greedy=False
r.SearchPattern="^"+data.ReplaceB(".","\.")+"\t.+"




As you can see its pretty simple.

Now my new problem is taking 5000 samples a second and trimming that to
100 samples a second.

Heres what 5000 samples a second data looks like:
0
0.000209996
0.000419992
0.000629987
0.000839983
0.001049979
0.001259975
0.001469971
0.001679966
0.001889962
0.002099958
0.002309954
0.00251995
0.002729945
0.002939941
0.003149937
0.003359933
0.003569929
0.003779924
0.00398992
0.004199916
0.004409912
0.004619908
0.004829903
0.005039899
0.005249895
0.005459891
0.005669887
0.005879882
0.006089878
0.006299874
0.00650987
0.006719866
0.006929861
0.007139857
0.007349853
0.007559849
0.007769845
0.00797984
0.008189836
0.008399832
0.008609828
0.008819824
0.009029819
0.009239815
0.009449811
0.009659807
0.009869803
0.010079798
0.010289794
0.01049979
0.010709786
0.010919782
0.011129777
0.011339773
0.011549769
0.011759765
0.011969761
0.012179756
0.012389752
0.012599748
0.012809744
0.01301974
0.013229735
0.013439731
0.013649727
0.013859723
0.014069719
0.014279714
0.01448971
0.014699706
0.014909702
0.015119698
0.015329693
0.015539689
0.015749685
0.015959681
0.016169677
0.016379672
0.016589668
0.016799664
0.01700966
0.017219656
0.017429651
0.017639647
0.017849643
0.018059639
0.018269635
0.01847963
0.018689626
0.018899622
0.019109618
0.019319614
0.019529609
0.019739605
0.019949601
0.020159597
0.020369593
0.020579588
0.020789584
0.02099958
0.021209576
0.021419572
0.021629567
0.021839563
0.022049559
0.022259555
0.022469551
0.022679546
0.022889542
0.023099538
0.023309534
0.02351953
0.023729525
0.023939521
0.024149517
0.024359513
0.024569509
0.024779504
0.0249895
0.025199496
0.025409492
0.025619488
0.025829483
0.026039479
0.026249475
0.026459471
0.026669467
0.026879462
0.027089458
0.027299454
0.02750945
0.027719446
0.027929441
0.028139437
0.028349433
0.028559429
0.028769425
0.02897942
0.029189416
0.029399412
0.029609408
0.029819404
0.030029399
0.030239395
0.030449391
0.030659387
0.030869383
0.031079378
0.031289374
0.03149937
0.031709366
0.031919362
0.032129357
0.032339353
0.032549349
0.032759345
0.032969341
0.033179336
0.033389332
0.033599328
0.033809324
0.03401932
0.034229315
0.034439311
0.034649307
0.034859303
0.035069299
0.035279294
0.03548929
0.035699286
0.035909282
0.036119278
0.036329273
0.036539269
0.036749265
0.036959261
0.037169257
0.037379252
0.037589248
0.037799244
0.03800924
0.038219236
0.038429231
0.038639227
0.038849223
0.039059219
0.039269215
0.03947921
0.039689206
0.039899202
0.040109198


That gives you an idea.


So anyone have an idea how to change my existing code to do what I want?

Ive played with it and cant seem to nail it down.


Any help appreciated.


Thanks,

Tom


:.________________
CONFIDENTIALITY : This e-mail and any attachments are confidential and may be privileged. If you are not a named recipient, please notify the sender immediately and do not disclose the contents to another person, use
it for any purpose or store or copy the information in any medium.
_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to